compareScenariosLimes: Render compareScenariosLimes

View source: R/compareScenariosLimes.R

compareScenariosLimesR Documentation

Render compareScenariosLimes

Description

Renders the *.Rmd-files associated to compareScenariosLimes. In the Rmds, scenario- and historical .mif-files are loaded. Then plots are created from this data. The result may be rendered to PDF or HTML. Alternatively one can choose Rmd as output format and obtain a copy of the *.Rmd-files.

Usage

compareScenariosLimes(
  mifScen,
  outputDir = getwd(),
  outputFile = "compareScenariosLimes",
  outputFormat = "PDF",
  envir = new.env(),
  quiet = FALSE,
  ...
)

Arguments

mifScen

character(n), optionally named. Paths to scenario mifs. If the vector has names, those are used to refer to the scenarios in the output file.

outputDir

character(1). The directory where the output document and intermediary files are created.

outputFile

character(1). File name (without extension) of the output document to be created.

outputFormat

character(1), not case-sensitive. "html", "pdf", or "rmd".

envir

environment. The environment in which the code chunks are to be evaluated. See the argument of the same name in rmarkdown::render(). Set this to globalenv() and sections to NULL to load an preprocess data in your global environment during development.

quiet

logical(1). Suppress printing during rendering?

...

YAML parameters, see below.

Value

The value returned by rmarkdown::render().

YAML Parameters

cfgScen

character(n) or NULL. Paths to config.Rdata files containing the cfg object for each scenario. The paths must be provided in the same order as mifScen. If provided, some information gathered from these files is shown at the beginning of the output document.

cfgDefault

character(1) or NULL. Path to default.cfg, which creates a cfg object with default values. If provided, some information gathered from this file is shown at the beginning of the output document.

yearsScen

numeric(n). Default: c(seq(2005, 2060, 5), seq(2070, 2100, 10)). Years to show for scenario data.

yearsHist

numeric(n). Default: c(seq(1960, 2020, 1), seq(2025, 2100, 5)). Years to show for historical data.

yearsBarPlot

numeric(n). Default: c(2010, 2030, 2050, 2100). Years to show in bar plots of scenario data.

yearRef

numeric(1). Default: 2020. A reference year used to show relative values in Kaya decomposition.

reg

NULL or character(n). Default: NULL. Regions to show. NULL means all.

modelsHistExclude

character(n) or NULL. Default: c(). Models in historical data to exclude.

sections

character(n) or numeric(n) or NULL. Default: "all". Names or numbers of sections to include. For names subset of c("00_info", "01_summary", "02_macro", "03_emissions", "04_energy_supply", "05_energy_demand", "06_energy_services", "07_climate", "08_sdp", "09_carbon_management", "99_further_info"). Use "all" to include all available sections. Use NULL to not include any section (useful in combination with parameter envir).

userSectionPath

NULL or character(n). Default: NULL. Path to a *.Rmd-file that may be included as additional section.

mainReg

character(1). Default: "World". A region for which larger plots are shown.

figWidth, figHeight

numeric(1). Default: 15 and 10, respectively. Size of plots in inches.

warning

logical(1). Default: TRUE. Show warnings in output?

Author(s)

Christof Schoetz

Examples

## Not run: 
# Simple use. Creates PDF:
compareScenariosLimes(
  mifScen = c("path/to/Base.mif", "path/to/NDC.mif"),
  outputFile = "compareScenariosLimesExample")
# More complex use. Creates folder with Rmds:
compareScenariosLimes(
  mifScen = c(ScenarioName1 = "path/to/scen1.mif", ScenarioName2 = "path/to/scen2.mif"),
  cfgScen = c("path/to/scen1/config.RData", "path/to/scen2/config.RData"),
  cfgDefault = "path/to/default.cfg",
  outputDir = "path/to/output",
  outputFormat = "Rmd",
  outputFile = format(Sys.time(), "compScen_%Y%m%d-%H%M%S"),
  warning = FALSE,
  sections = c(0, 2, 3, 99),
  userSectionPath = "path/to/myPlots.Rmd")
# Use in development. Load data into global environment:
compareScenariosLimes(
  mifScen = c("path/to/scen1.mif", "path/to/scen2.mif"),
  outputFile = format(Sys.time(), "cs2_load_%Y%m%d-%H%M%S"),
  sections = NULL,
  envir = globalenv())

## End(Not run)

pik-piam/limes documentation built on Jan. 27, 2024, 4:45 a.m.