Skip to contents

adapt_saa() extracts files from annual agricultural statistical archive typically downloaded with download_saa().

Usage

adapt_saa(
  origin,
  destination = tempdir(),
  archive = "SAA_2010-2024.zip",
  scope = c("departement", "region", "national"),
  group_category = "crop",
  verbose = TRUE,
  retrieve = FALSE,
  scheme = floodam.data::scheme_saa,
  nomenclature_saa = floodam.data::nomenclature_saa
)

Arguments

origin

character, path to the directory where archive is stored

destination

character, path to the directory where results should be saved. Default to tempdir().

archive

character, vector of archive to be adpated. Default to "SAA_2010-2024.zip" (default name when downloaded with download_saa())

scope

character, vector containing the name of scope or scopes to be adapted. One of c(NULL, "departement", "region"). If NULL, all will be treated.

group_category

character, vector indicating which data category should be kept. Default to "crop". See "inst/extdata/nomenclature_saa.csv" for more info. Does not work with "livestock" at the moment.

verbose

boolean, will floodam tell what it is doing, default to TRUE.

retrieve

logical, should the output be retrieved or not. Default to TRUE. If more than one scope is adapted, all scopes will be retrieved in a list.

scheme

data.frame, how archive variables should be treated. Default to floodam.data::scheme_saa

nomenclature_saa

data.frame, correspondance table between SAA crop nomenclature and group_category. Default to floodam.data::nomenclature_saa.

Examples

if (FALSE) { # \dontrun{
destination = tempdir()
download_saa(destination)
result = adapt_saa(
 origin = destination,
 destination = destination,
 scope = "departement",
 retrieve = TRUE
)
result = adapt_saa(
 origin = destination,
 destination = destination,
 scope = c("departement", "region", "national"),
 retrieve = TRUE
)
} # }