getDataForAllScens() gets slot data from multiple rdf files and/or multiple scenarios, aggregates it, and saves it as a data.frame. The slot data can be aggregated in multiple ways (see slot_agg_list ).
scenFolders: A string vector containing the folder names (scenarios) that the rdf files are saved in.
scenNames: A string vector containing the scenario names. This should be the same length as scenFolders. The scenario names are used as attributes to the data in the Scenario column.
slotAggList: The slot aggregation list. Either an object of class slot_agg_list or a "special" list with the keyword "all". If, it is a slot_agg_list , see that documentation for how to control the aggregation methods used in this function. If all of the slots in an entire rdf are desired, use a list of lists with each entry containing an rdf file and the keyword "all" for the slots, e.g., list(list(rdf = 'KeySlots.rdf',slots = 'all')). If this option is used, the function will return raw monthly, or annual data, i.e., no aggregation methods will be applied to the data in the rdf file.
scenPath: An absolute or relative path to the folder containing scenFolders.
oFile: If not NULL, then an absolute or relative path with the file name of the location the table will be saved to. Valid file types are .csv, .txt, or .feather.
retFile: Deprecated. Data are always returned invisibly.
findAllSlots: Boolean; if TRUE (default), then the function will abort if it cannot find a particular slot. If FALSE, then the function will continue, even if a slot cannot be found. If a slot is not found, then the function will return -99 for the Trace, Year, and Value.
Returns
A data.frame returned invisibly.
Examples
# get a specified set of slots and apply some aggregation method to them# get the data from two scenariosscenFolders <- c('ISM1988_2014,2007Dems,IG,Most','ISM1988_2014,2007Dems,IG,2002')# slotAggTable.csv lists the slots to obtain, and the aggregation method to # apply to themslotAggList <- slot_agg_list( system.file('extdata','SlotAggTable.csv',package ='RWDataPlyr'))scenPath <- system.file('extdata','Scenario/',package ='RWDataPlyr')# expect Deprecated warningtestthat::expect_warning( keyData <- getDataForAllScens( scenFolders, scenNames = scenFolders, slotAggList = slotAggList, scenPath = scenPath
))# get all of the data from the KeySlots rdf filescenFolders <- scenFolders[1]# only one scenarioslotAggList <- list(list(rdf ='KeySlots.rdf', slots ='all'))# will return monthly data for all slots in KeySlots.rdf# expect Deprecated warningtestthat::expect_warning( allData <- getDataForAllScens( scenFolders, scenNames = scenFolders, slotAggList = slotAggList, scenPath = scenPath
))