if (FALSE) {
# Install helloworldSpatial package from package server
addPackage("helloworldSpatial")
# Set the file path and name of the new SsimLibrary
myLibraryName <- file.path(tempdir(),"testlib_datasheet")
# Set the SyncroSim Session
mySession <- session()
# Create a new SsimLibrary with the example template from helloworldSpatial
myLibrary <- ssimLibrary(name = myLibraryName,
session = mySession,
package = "helloworldSpatial",
template = "example-library",
forceUpdate = TRUE)
# Set the Project and Scenario
myProject <- project(myLibrary, project = "Definitions")
myScenario <- scenario(myProject, scenario = "My Scenario")
# Get all Datasheet info for the Scenario
myDatasheets <- datasheet(myScenario)
# Return a list of data.frames (1 for each Datasheet)
myDatasheetList <- datasheet(myScenario, summary = FALSE)
# Get a specific Datasheet
myDatasheet <- datasheet(myScenario, name = "RunControl")
# Include primary key when retrieving a Datasheet
myDatasheet <- datasheet(myScenario, name = "RunControl", includeKey = TRUE)
# Return all columns, including optional ones
myDatasheet <- datasheet(myScenario, name = "RunControl", summary = TRUE,
optional = TRUE)
# Return Datasheet as an element
myDatasheet <- datasheet(myScenario, name = "RunControl", forceElements = TRUE)
myDatasheet$helloworldSpatial_RunControl
# Get a Datasheet without pre-specified values
myDatasheetEmpty <- datasheet(myScenario, name = "RunControl", empty = TRUE)
# If Datasheet is empty, do not return dependencies as factors
myDatasheetEmpty <- datasheet(myScenario, name = "RunControl", empty = TRUE,
lookupsAsFactors = FALSE)
# Optimize query
myDatasheet <- datasheet(myScenario, name = "RunControl", fastQuery = TRUE)
# Get specific SsimLibrary core Datasheet
myDatasheet <- datasheet(myLibrary, name = "core_Backup")
# Use an SQL statement to query a Datasheet
mySQL <- sqlStatement(
groupBy = c("ScenarioID"),
aggregate = c("MinimumTimestep"),
where = list(MinimumTimestep = c(1))
)
myAggregatedDatasheet <- datasheet(myScenario, name = "RunControl",
sqlStatement = mySQL)
}
Run the code above in your browser using DataLab