Skip to contents

Processes the "feedtimes" file from 'GreenFeed' system, including visits and food drops across a specific period, and it is used to calculate pellet intakes per animal from all units. Aggregates data to provide insights into the feeding behavior and pellet consumption of the animals during a study.

Arguments

file_path

a character string or list representing files(s) with "feedtimes" from 'C-Lock Inc.'

unit

numeric or character vector or list representing one or more 'GreenFeed' unit numbers. The order should match with "feedtimes" files

gcup

a numeric value representing the grams of pellets per cup.

start_date

a character string representing the start date of the study (format: "mm/dd/yyyy")

end_date

a character string representing the end date of the study (format: "mm/dd/yyyy")

save_dir

a character string representing the directory to save the output file

rfid_file

a character string representing the file with individual IDs. The order should be Visual ID (col1) and RFID (col2)

Value

An Excel file with pellet intakes for all animals and days within the specified period is saved to save_dir. The file is named "Pellet_Intakes_YYYY-MM-DD_YYYY-MM-DD.csv".

Examples

# You should provide the 'feedtimes' file provided by C-Lock.
# it could be a list of files if you have data from multiple units to combine
path <- list(system.file("extdata", "feedtimes.csv", package = "greenfeedr"))

# You must include the grams of pellets per cup based on the result obtained from the 10-drops test

# If the user include an rfid file, the structure should be in col1 AnimalName or Visual ID, and
# col2 the RFID or TAG_ID. The file could be save in different formats (.xlsx, .csv, or .txt).
RFIDs <- system.file("extdata", "RFID_file.csv", package = "greenfeedr")

pellin(
  file_path = path,
  unit = 1,
  gcup = 34,
  start_date = "2024-05-13",
  end_date = "2024-05-25",
  save_dir = tempdir(),
  rfid_file = RFIDs
)
#> Please set the 'gcup' parameter based on the 10-drops test.
#>            If units have different gram values, define 'gcup' as a vector with an element for each unit.
#> Animal ID not visting GreenFeed: Animal11, Animal12, Animal13, Animal14, Animal16, Animal17, Animal18, Animal19, Animal20, Animal21, Animal22, Animal23, Animal24, Animal25, Animal26, Animal27, Animal28, Animal29, Animal30, Animal32
#> Pellet intakes file created and saved to /tmp/Rtmp7041wK
#> # A tibble: 416 × 4
#>    Date       FarmName RFID            PIntake_kg
#>    <date>     <chr>    <chr>                <dbl>
#>  1 2024-05-13 Animal1  840003234513777      0.714
#>  2 2024-05-13 Animal10 840003250681777      0.578
#>  3 2024-05-13 Animal15 840003250681666      1.26 
#>  4 2024-05-13 Animal2  840003250681999      0.34 
#>  5 2024-05-13 Animal3  840003250681888      0.374
#>  6 2024-05-13 Animal31 840003250681666      1.26 
#>  7 2024-05-13 Animal4  840003250681111      0.068
#>  8 2024-05-13 Animal5  840003250681222      0.85 
#>  9 2024-05-13 Animal6  840003250681444      0.034
#> 10 2024-05-13 Animal7  840003250681666      1.26 
#> # ℹ 406 more rows