Accesses and downloads United States Department of Agriculture CropScape Cropland Data Layer data from the USDA National Agricultural Statistics Service or the George Mason University website.
Arguments
- year
integer(1). Year of the data to download.
- source
character(1). Data source, one of
c("USDA", "GMU")
."USDA"
will download the national data from the USDA website (available in 2008-last year)."GMU"
will download the data from the George Mason University website (available in 1997-last year).
- directory_to_save
character(1). Directory to download files.
- acknowledgement
logical(1). By setting
TRUE
the user acknowledges that the data downloaded using this function may be very large and use lots of machine storage and memory.- download
logical(1).
FALSE
will generate a *.txt file containing all download commands. By settingTRUE
the function will download all of the requested data files.- remove_command
logical(1). Remove (
TRUE
) or keep (FALSE
) the text file containing download commands.- unzip
logical(1). Unzip the downloaded compressed files. Default is
FALSE
.- hash
logical(1). By setting
TRUE
the function will return anrlang::hash_file()
hash character corresponding to the downloaded files. Default isFALSE
.
Value
For
hash = FALSE
, NULLFor
hash = TRUE
, anrlang::hash_file
character.Yearly comma-separated value (CSV) files will be stored in
directory_to_save
.
Examples
if (FALSE) { # \dontrun{
download_cropscape(
year = 2020,
source = "USDA",
directory_to_save = tempdir(),
acknowledgement = TRUE,
download = FALSE, # NOTE: download skipped for examples,
remove_command = TRUE,
unzip = FALSE
)
} # }