Title: | Process and Report 'GreenFeed' Data |
---|---|
Description: | Provides tools for downloading, processing, and reporting daily and finalized 'GreenFeed' data. |
Authors: | Guillermo Martinez-Boggio [cre, aut, cph]
|
Maintainer: | Guillermo Martinez-Boggio <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.0 |
Built: | 2025-01-30 10:23:57 UTC |
Source: | https://github.com/gmbog/greenfeedr |
Compare preliminary and finalized 'GreenFeed' data.
prelimrep |
a data frame with preliminary 'GreenFeed' data |
finalrep |
a data frame with finalized 'GreenFeed' data |
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") |
Data frame including records removed from preliminary and final reports
#Datasets with preliminary and finalized GreenFeed data prelimrep <- system.file("extdata", "StudyName_GFdata.csv", package = "greenfeedr") finalrep <- system.file("extdata", "StudyName_FinalReport.xlsx", package = "greenfeedr") data <- compare_gfdata( prelimrep, finalrep, start_date = "2024-05-13", end_date = "2024-05-20")
#Datasets with preliminary and finalized GreenFeed data prelimrep <- system.file("extdata", "StudyName_GFdata.csv", package = "greenfeedr") finalrep <- system.file("extdata", "StudyName_FinalReport.xlsx", package = "greenfeedr") data <- compare_gfdata( prelimrep, finalrep, start_date = "2024-05-13", end_date = "2024-05-20")
Downloads preliminary 'GreenFeed' data from the 'C-Lock Inc.' server via an 'API'. Retrieves data based on specified parameters (login, date range, and units), and provides a CSV file with the 'GreenFeed' preliminary data.
get_gfdata( user, pass, exp = NA, unit, start_date, end_date = Sys.Date(), save_dir = tempdir() )
get_gfdata( user, pass, exp = NA, unit, start_date, end_date = Sys.Date(), save_dir = tempdir() )
user |
a character string representing the user name to logging into 'GreenFeed' system |
pass |
a character string representing password to logging into 'GreenFeed' system |
exp |
a character string representing study name or other study identifier. It is used as file name to save the data |
unit |
numeric or character vector, or a list representing one or more 'GreenFeed' unit numbers |
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 |
A CSV file with preliminary 'GreenFeed' data in the specified directory
# Please replace "your_username" and "your_password" with your actual 'GreenFeed' credentials. # Example with units as a vector get_gfdata( user = "your_username", pass = "your_password", exp = "StudyName", unit = c(304, 305), start_date = "2024-01-01", end_date = Sys.Date(), save_dir = tempdir() )
# Please replace "your_username" and "your_password" with your actual 'GreenFeed' credentials. # Example with units as a vector get_gfdata( user = "your_username", pass = "your_password", exp = "StudyName", unit = c(304, 305), start_date = "2024-01-01", end_date = Sys.Date(), save_dir = tempdir() )
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.
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) |
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".
# 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 )
# 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 )
Processes and calculates daily and weekly averages of 'GreenFeed' data. Handles data filtering, aggregation, and summarization to facilitate further analysis.
data |
a data frame with preliminary or finalized 'GreenFeed' data |
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") |
param1 |
an integer representing the number of records per day to be consider for analysis |
param2 |
an integer representing the number of days with records per week to be consider for analysis |
min_time |
an integer representing the minimum number of minutes for a records to be consider for analysis (default: 2 minutes) |
cutoff |
an integer specifying the range for identifying outliers (default: 3 SD) |
A list of two data frames:
daily_data |
data frame with daily processed 'GreenFeed' data |
weekly_data |
data frame with weekly processed 'GreenFeed' data |
file <- system.file("extdata", "StudyName_GFdata.csv", package = "greenfeedr") datafile <- readr::read_csv(file) gf_data <- process_gfdata( data = datafile, start_date = "2024-05-13", end_date = "2024-05-25", param1 = 2, param2 = 3, min_time = 2 ) head(gf_data)
file <- system.file("extdata", "StudyName_GFdata.csv", package = "greenfeedr") datafile <- readr::read_csv(file) gf_data <- process_gfdata( data = datafile, start_date = "2024-05-13", end_date = "2024-05-25", param1 = 2, param2 = 3, min_time = 2 ) head(gf_data)
Generates a PDF report of preliminary and finalized 'GreenFeed' data. The report includes: number of animals using 'GreenFeed' and plots with distribution of records and gas production. If the preliminary option is used, the data is retrieved from the 'C-Lock Inc.' server through an 'API', otherwise the data processed by 'C-Lock Inc.' must be provided to generate the report.
input_type |
a character string representing type of data (options: "prelim" or "daily, and "final") |
exp |
a character string representing study name or other study identifier. It is used as file name to save the data |
unit |
numeric or character vector, or a list representing one or more 'GreenFeed' unit numbers |
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 |
plot_opt |
a character string representing the gas(es) to plot (options: "All", "CH4", "CO2", "O2", "H2") |
rfid_file |
a character string representing the file with individual IDs. The order should be Visual ID (col1) and RFID (col2) |
user |
a character string representing the user name to logging into 'GreenFeed' system. If input_type is "final", this parameter is ignored |
pass |
a character string representing password to logging into 'GreenFeed' system. If input_type is "final", this parameter is ignored |
file_path |
A list of file paths containing the final report(s) from the 'GreenFeed' system. If input_type is "prelim", this parameter is ignored |
A CSV file with preliminary 'GreenFeed' data and a PDF report with a description of the preliminary or finalized data
# Please replace "your_username" and "your_password" with your actual 'GreenFeed' credentials. # The data range must be fewer than 180 days # Example without rfid_file (by default NA) report_gfdata( user = "your_username", pass = "your_password", input_type = "prelim", exp = "StudyName", unit = 1, start_date = "2023-01-01", end_date = Sys.Date(), save_dir = tempdir(), plot_opt = "All" )
# Please replace "your_username" and "your_password" with your actual 'GreenFeed' credentials. # The data range must be fewer than 180 days # Example without rfid_file (by default NA) report_gfdata( user = "your_username", pass = "your_password", input_type = "prelim", exp = "StudyName", unit = 1, start_date = "2023-01-01", end_date = Sys.Date(), save_dir = tempdir(), plot_opt = "All" )
Processes 'GreenFeed' visits and food drops for a requested period. Generates a list of animals not visiting the 'GreenFeed' to manage them, and a description of animals visiting the 'GreenFeed'.
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. |
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") |
rfid_file |
a character string representing the file with individual RFIDs. The order should be Visual ID (col1) and RFID (col2) |
A list of two data frames:
visits_per_unit |
Data frame with daily processed 'GreenFeed' data, including columns for VisualID, Date, Time, number of drops, and visits. |
visits_per_animal |
Data frame with weekly processed 'GreenFeed' data, including columns for VisualID, total drops, total visits, mean drops, and mean visits. |
# You should provide the feedtimes files. # 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")) # If the user include an rfid file, the structure should be in col1 AnimalName or VisualID, 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") data <- viseat( file_path = path, unit = 1, start_date = "2024-05-13", end_date = "2024-05-25", rfid_file = RFIDs )
# You should provide the feedtimes files. # 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")) # If the user include an rfid file, the structure should be in col1 AnimalName or VisualID, 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") data <- viseat( file_path = path, unit = 1, start_date = "2024-05-13", end_date = "2024-05-25", rfid_file = RFIDs )