Downloads daily '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' daily data.
Arguments
- 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
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")
exp <- "StudyName"
start_date <- "2024-01-01"
end_date <- Sys.Date()
save_dir <- tempdir()
# Example with units as a vector
unit <- c(304, 305)
get_gfdata(user, pass, exp, unit, start_date, end_date, save_dir)
}