The goal of feedeffir is to process feed efficiency files and calculate total dry matter intake, metabolic body weight, delta body weight, and milk energy.
You can install the development version of feedeffir from GitHub with:
#install.packages("remotes")
remotes::install_github("GMBog/feedeffir")feedeffir handles two main types of data:
- Raw Data:
- Description: This includes unprocessed datasets directly from the farm. Examples are raw milk weights from DC and AFI system, feed intake files from RIC2 Discover system, and milk composition files.
- Usage: Functions that operate on raw data are designed for pre-processing and compilation.
- Compiled Feed Efficiency Data:
- Description: This includes compiled datasets from raw data and include metrics such as milk weights, milk composition, and feed intakes.
- Usage: Functions targeting compiled files focus on analyzing feed efficiency traits. They require data that has already been processed from raw inputs.
To work with raw data, use functions to preprocess and create the initial data sets:
process_VRfiles()mixers()process_DC_milkw()process_AFI_milkw()
To compile data, use the compiler() function with different types of
files (body weights, milk weights, milk composition, and VR).
For detailed examples of how to use these functions, refer to the Examples section.
This is a basic example which shows you how to solve a common problem:
library(feedeffir)
# Process VR files with intakes
data <- process_VRfiles(
exp = "Study1",
VRfile = system.file("extdata", "VR250412.DAT", package = "feedeffir"),
bins = seq(1, 32),
save_dir = tempdir()
)
#> The VR file was processed and the result saved at /var/folders/8n/lmf4l1hs7jz2m86j5g16k21c0000gn/T//Rtmp5ztHxVhead(data)
#> # A tibble: 6 × 6
#> TrialID Date Visible_ID Feed FedKg Obs
#> <chr> <date> <dbl> <chr> <dbl> <lgl>
#> 1 Study1 2025-04-12 1033 HS 79.9 NA
#> 2 Study1 2025-04-12 1062 LS 66.3 NA
#> 3 Study1 2025-04-12 1064 LS 81.1 NA
#> 4 Study1 2025-04-12 1115 HS 90.8 NA
#> 5 Study1 2025-04-12 1124 HS 70.9 NA
#> 6 Study1 2025-04-12 1143 LS 73.4 NA
# The next step is to compile the processed VR files
# compile_VRfiles(dir = "~/Downloads/files/",
# compfile = "UW_Study1_CompiledIntakes.xlsx",
# data = data)
# Process milk weights from Dairy Comp
data <- process_DC_milkw(exp = "Study1",
file_path = system.file("extdata", "MilkWeight_DCfile.xls", package = "feedeffir"),
save_dir = tempdir())
#> Number of cows in file: 64
#> Time range:
#> 2025-08-23
#> 2025-08-22
#> 2025-08-21
#> 2025-08-20
#> 2025-08-19
#> 2025-08-18
#> 2025-08-17
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> 0.00 45.00 53.00 52.88 62.00 89.00
head(data)
#> Trial_ID Date MilkNum Visible_ID MilkLbs
#> 1 Study1 2025-08-23 PM 1001 66
#> 2 Study1 2025-08-23 PM 1068 53
#> 3 Study1 2025-08-23 PM 1069 51
#> 4 Study1 2025-08-23 PM 1074 57
#> 5 Study1 2025-08-23 PM 1092 49
#> 6 Study1 2025-08-23 PM 1097 44