Description Usage Arguments Value See Also Examples
View source: R/getDataFromRdf.R
getDataForAllScens
gets slot data from multiple rdf files and for multiple scenarios.
The slot data can be aggregated in multiple ways (see createSlotAggList
). Slot data is then converted to a molten data frame using reshaphe2::melt
and saved as a txt file for later use.
1 2 | getDataForAllScens(scenFolders, scenNames, slotAggList, scenPath, oFile,
retFile = FALSE)
|
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 |
slotAggList |
The slot aggregation list. A list containing the slots that will be
imported and aggregated, the aggregation method(s) to use, and the rdf files that
contain the slots. Either created by calling |
scenPath |
An absolute or relative path to the folder containing |
oFile |
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 |
If |
If retFile
is TRUE
, a dataframe, otherwise nothing is returned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # get a specified set of slots and apply some aggregation method to them
scenFolders <- c('DNF,CT,IG', 'DNF,CT,IG,Ops1') # get the data from two scenarios
scenNames <- scenFolders
# slotAggTable.csv lists the slots to obtain, and the aggregation method to apply to them
slotAggList <- createSlotAggList(system.file('extdata','SlotAggTable.csv',package = 'RWDataPlot'))
scenPath <- system.file('extdata','Scenario/',package = 'RWDataPlot')
oFile <- 'tmp.feather'
retFile <- TRUE # return the data, instead of only save it as a text file
keyData <- getDataForAllScens(scenFolders, scenNames, slotAggList, scenPath, oFile, retFile)
# get all of the data from the KeySlots rdf file
scenFolders <- scenNames <- scenNames[1] # only one scenario
slotAggList <- list(list(rdf = 'KeySlots.rdf', slots = 'all'))
# will return monthly data for all slots in KeySlots.rdf
allData <- getDataForAllScens(scenFolders, scenNames, slotAggList, scenPath, oFile, retFile)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.