Skip to contents

adapt_insee_serie() adapts INSEE time series data to a common format.

Usage

adapt_insee_serie(
  origin,
  destination = tempdir(),
  archive,
  scheme = floodam.data::scheme_insee_serie,
  output_format = c("rds", "csv"),
  frequency = NULL,
  retrieve = TRUE,
  verbose = TRUE
)

Arguments

origin

character, folder name where the original INSEE series are located.

destination

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

archive

character, vector name of the RDS archive file containing the INSEE series to be adapted. Typically the result of retrieve_insee_serie()

scheme

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

output_format

character, desired output format. Can be "rds" or "csv". "rds" will export a list of data frames. "csv" will export individual CSV files for each index/base combination.

frequency

character, vector specifying the desired frequency of the time series ("A" for Annual, "M" for Monthly). If NULL, both will be kept

retrieve

boolean, should the result be returned.

verbose

boolean, should the function give some sumup informations. Default to TRUE

Value

If retrieve is TRUE, the function returns a list of data frames, where each data frame represents an adapted time series.

Details

The following treatments are performed:

  • Applying a scheme to standardize the data.

  • Filtering the data based on the desired frequency.

  • Extracting category information from the time series titles.

  • Export of adapted data accordingly to output_format. If set to rds, exported data will be a list of data.frames, if set to .csv, it will be as many .csv files as there are INSEE series in archive.