Skip to contents

[Experimental] Creates a zip archive "filename".zip

Usage

reporting_save_archive(
  x,
  filename = NULL,
  filepath = tempdir(),
  saveRDS = FALSE
)

Arguments

x

A list like the one created by function reporting_produce_data_object_v1.3

filename

A character. Optional filename associated with the object, of the form provided as output by the function reporting_compose_file_name. Defaults to random string

filepath

A character file path. Defaults to temporary directory

saveRDS

A logical. Save also object in RDS format. Defaults to FALSE

Value

named A list containing paths to saved files filepaths. Slots are named "zip" and possibly "RDS".

Note

This method must be intended as a signpost for future implementation

See also

Peterseil, Geiger et al. (2020) Field Specification for data reporting. Technical Document. TechDoc.01. EU Horizon 2020 eLTER PLUS Project, Grant agreement No. 871128 https://zenodo.org/record/6373410

Author

Paolo Tagliolato, phD tagliolato.p@irea.cnr.it

Alessandro Oggioni, phD oggioni.a@irea.cnr.it

Examples

if (FALSE) {
## Not run:

deimsid <- "https://deims.org/8eda49e9-1f4e-4f3e-b58e-e0bb25dc32a6"
time_span <- 2015 # e.g. whole year
# time_span <- "20150302-20180415" # e.g. span between two dates
data_topic <- "VEG" # data provider defined abbreviation of "vegetation"
variable_group <- "SPECCOVER" # data provider defined abbreviation
version <- "V20220907"

filename <- reporting_compose_file_name(
  deimsid = deimsid,
  data_topic = data_topic,
  variable_group = variable_group,
  time_span = time_span,
  version = version
)

data <- dplyr::tribble(
  ~id, ~value,
  1, 7.5,
  2, 4.2
)
station <- dplyr::tribble(
  ~SITE_CODE, ~STATION_CODE, ~STYPE, ~LAT,      ~LON,       ~ALTITUDE,
  deimsid,    "IP2",         "AREA",  45.340805, 7.88887495, 265
)

method <- dplyr::tribble(
  ~VARIABLE, ~METH_DESCR,
  "COVE_F",  "Analysis of ammonium..." 
)

research_object <- reporting_produce_data_object_v1.3(
 filename = filename,
 deimsid = deimsid,
 data = data,
 station = station,
 method = method
)

archive <- reporting_save_archive(
  x = research_object,
  # obtained from the function `reporting_produce_data_object_v1.3()`
  filename = filename,
  # obtained from the function `reporting_compose_file_name()`
  filepath = ".",
  saveRDS = TRUE
)

## End (Not run)
}