## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----install-cran, eval=FALSE-------------------------------------------------
# install.packages("LactCurveModels")

## ----install-github, eval=FALSE-----------------------------------------------
# # install.packages("devtools")
# devtools::install_github("venkatesanraja/LactCurveModels")

## ----setup--------------------------------------------------------------------
library(LactCurveModels)

## ----basic-usage, eval=FALSE--------------------------------------------------
# results <- run_lactation_analysis(
#   input_csv_path = "path/to/your/data.csv"
# )

## ----custom-outdir, eval=FALSE------------------------------------------------
# results <- run_lactation_analysis(
#   input_csv_path = "path/to/your/data.csv",
#   out_dir        = "D:/my_results/lactation_analysis"
# )

## ----selected-models, eval=FALSE----------------------------------------------
# results <- run_lactation_analysis(
#   input_csv_path  = "path/to/your/data.csv",
#   selected_models = c("Wood_1967", "Wilmink_k005", "Ali_Schaeffer",
#                       "Pollott_Multiplicative")
# )

## ----selected-animals, eval=FALSE---------------------------------------------
# results <- run_lactation_analysis(
#   input_csv_path   = "path/to/your/data.csv",
#   selected_animals = c("Animal_A", "Animal_C")
# )

## ----combined, eval=FALSE-----------------------------------------------------
# results <- run_lactation_analysis(
#   input_csv_path   = "path/to/your/data.csv",
#   selected_models  = c("Wood_1967", "Wilmink_k005", "Ali_Schaeffer"),
#   selected_animals = c("Animal_A", "Animal_B"),
#   out_dir          = "D:/results"
# )

## ----access-results, eval=FALSE-----------------------------------------------
# # View goodness-of-fit metrics for Animal_A
# results[["Animal_A"]]$metrics_df
# 
# # View parameter estimates for Animal_A
# results[["Animal_A"]]$param_table
# 
# # Access the fitted nls object for Wood (1967) model
# results[["Animal_A"]]$model_fits[["Wood_1967"]]$model
# 
# # View model coefficients
# coef(results[["Animal_A"]]$model_fits[["Wood_1967"]]$model)
# 
# # View individual metrics
# results[["Animal_A"]]$model_fits[["Wood_1967"]]$metrics

## ----fit-direct, eval=FALSE---------------------------------------------------
# # Build a data frame for one animal
# animal_df <- data.frame(
#   x = 1:20,
#   y = c(9.3, 9.9, 10.2, 10.4, 10.3, 10.1, 9.9, 9.6, 9.3, 9.0,
#         8.7, 8.4, 8.1, 7.8, 7.5, 7.2, 6.9, 6.6, 6.3, 6.0),
#   z = (1:20) / 365
# )
# 
# # Fit all 20 models
# fits <- fit_lactation_models(animal_df)
# 
# # Fit selected models only
# fits <- fit_lactation_models(
#   animal_df,
#   selected_models = c("Wood_1967", "Wilmink_k005", "Ali_Schaeffer")
# )
# 
# # Access results
# fits[["Wood_1967"]]$metrics
# fits[["Wood_1967"]]$predictions
# coef(fits[["Wood_1967"]]$model)

## ----citation, eval=FALSE-----------------------------------------------------
# citation("LactCurveModels")

