Skip to contents

Generates a PDF report of daily and finalized 'GreenFeed' data. The report includes: number of animals using 'GreenFeed' and plots with distribution of records and gas production. If the daily 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.

Arguments

input_type

a character string representing type of data (options: "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 "final", this parameter is ignored

Value

A CSV file with daily 'GreenFeed' data and a PDF report with a description of the daily or finalized data

Examples

if (FALSE) { # has_credentials()
# Please replace "your_username" and "your_password" with your actual 'GreenFeed' credentials.
user <- Sys.getenv("API_USER")
pass <- Sys.getenv("API_PASS")

# The data range must be fewer than 180 days
# Example without rfid_file (by default NA)

report_gfdata(
  input_type = "daily",
  exp = "StudyName",
  unit = 1,
  start_date = "2023-01-01",
  end_date = Sys.Date(),
  save_dir = tempdir(),
  plot_opt = "All"
)
}