Skip to contents

Extracts information from scenario objects, based on filters.

Usage

getData(
  scen,
  name = NULL,
  ...,
  merge = FALSE,
  process = FALSE,
  parameters = TRUE,
  variables = TRUE,
  ignore.case = TRUE,
  newNames = NULL,
  newValues = NULL,
  na.rm = FALSE,
  digits = NULL,
  drop.zeros = FALSE,
  asTibble = TRUE,
  stringsAsFactors = FALSE,
  yearsAsFactors = FALSE,
  drop_duplicated_scenarios = TRUE,
  scenNameInList = as.logical(length(scen) - 1),
  verbose = FALSE
)

get_data(
  scen,
  name = NULL,
  ...,
  merge = FALSE,
  process = FALSE,
  parameters = TRUE,
  variables = TRUE,
  ignore.case = TRUE,
  newNames = NULL,
  newValues = NULL,
  na.rm = FALSE,
  digits = NULL,
  drop.zeros = FALSE,
  asTibble = TRUE,
  stringsAsFactors = FALSE,
  yearsAsFactors = FALSE,
  drop_duplicated_scenarios = TRUE,
  scenNameInList = as.logical(length(scen) - 1),
  verbose = FALSE
)

Arguments

scen

Object scenario or list of scenarios.

name

character vector with names of parameters and/or variables.

...

filters for various sets (setname = c(val1, val2) or setname_ = "matching pattern"), see details.

merge

if TRUE, the search results will be merged in one dataframe; the named list will be returned if FALSE.

process

if TRUE, dimensions "tech", "stg", "trade", "imp", "expp", "dem", and "sup" will be renamed with "process".

parameters

if TRUE, parameters will be included in the search and returned if found.

variables

if TRUE, variables will be included in the search and returned if found.

ignore.case

grepl parameter if regular expressions are used in '...' or 'name_'.

newNames

renaming sets, named character vector or list with new names as values, and old names as names - the input parameter to renameSets function. The operation is performed before merging the data (merge parameter).

newValues

revalue sets, named character vector or list with new values as values, and old values as names - the input parameter to revalueSets function. The operation is performed after merging the data (merge parameter).

na.rm

if TRUE, NA values will be dropped.

digits

if integer, indicates the number of decimal places for rounding, if NULL - no actions.

drop.zeros

logical, should rows containing zero values be filtered out.

asTibble

logical, if the data.frames should be converted into tibbles.

stringsAsFactors

logical, should the sets values be converted to factors?

yearsAsFactors

logical, should `year` be converted to factors? Set 'year' is integer by default.

scenNameInList

logical, should the name of the scenarios be used if not provided in the list with several scenarios?

verbose

Examples

data("utopia_scen_BAU.RData")
#> Warning: data set 'utopia_scen_BAU.RData' not found
getData(scen, name = "pDemand", year = 2015, merge = T)
#> Error in eval(expr, envir, enclos): object 'scen' not found
getData(scen, name = "vTechOut", comm = "ELC", merge = T, year = 2015)
#> Error in eval(expr, envir, enclos): object 'scen' not found
elc2050 <- getData(scen, parameters = FALSE, comm = "ELC", year = 2050)
#> Error in eval(expr, envir, enclos): object 'scen' not found
names(elc2050)
#> Error in eval(expr, envir, enclos): object 'elc2050' not found
elc2050$vBalance
#> Error in eval(expr, envir, enclos): object 'elc2050' not found