Skip to contents

Generates PDF reports of daily and final 'GreenFeed' data. If the option daily is used, data is retrieved from 'C-Lock Inc.' server via an 'API' and generates a PDF report to with number of animals, records, and gases production. However, if the option final is used, the finalized data should be provided to generates a PDF report to evaluate all 'GreenFeed' data obtained from the finalized study.

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 final records

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"
)
}