Skip to contents

Read data yaml file, get data, and output xlxs files

Usage

yaml_to_excel(
  file,
  xlsx_path = system.file("ennustedata_xlsx", package = "pttrobo"),
  start_year
)

Arguments

file

Path to yaml file

xlsx_path

A path to save excel files.

start_year

A numeric. Year to start data

Details

A data yaml file describes a list of excel files, sheets within them, and data within the sheets. There's an example file within the package to demonstrate the structure of the yaml file: system.file("ennustedata", "testi.yaml", package = "pttrobo"). The top-level list defines file names and the 2nd level defines sheet names. Under each sheet there's a list of data objects that describe what data is retrieved to populate the sheets. Each data object should at least contain an id to identify a data table in Robonomist Database. Additionally the data object can contain the following items: * muunnos This can take value "alkuperäinen", "vuosikeskiarvo", or "vuosisumma" * ajanjakso This can be set to "satovuosi" to aggregate annualy to intervals from July to June. * tiedot This shoud be a named list of variable names and values to be used as a filter for the data. The order of the named list is also used to arrage the data on to the excel sheets.

Examples

if (FALSE) {
esimerkkitiedosto <- system.file("ennustedata", "testi.yaml",
                                 package = "pttrobo")
yaml_to_excel(esimerkkitiedosto, start_year = "2011")
}