if (FALSE) {
# Install helloworldSpatial package from package server
installPackage("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,
packages = "helloworldSpatial")
# 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 = "helloworldSpatial_RunControl")
# Include primary key when retrieving a Datasheet
myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_RunControl",
includeKey = TRUE)
# Return all columns, including optional ones
myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_RunControl",
summary = TRUE, optional = TRUE)
# Return Datasheet as an element
myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_RunControl",
forceElements = TRUE)
myDatasheet$helloworldSpatial_RunControl
# Get a Datasheet without pre-specified values
myDatasheetEmpty <- datasheet(myScenario,
name = "helloworldSpatial_RunControl",
empty = TRUE)
# If Datasheet is empty, do not return dependencies as factors
myDatasheetEmpty <- datasheet(myScenario,
name = "helloworldSpatial_RunControl",
empty = TRUE,
lookupsAsFactors = FALSE)
# Optimize query
myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_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 = "helloworldSpatial_RunControl",
sqlStatement = mySQL)
}
Run the code above in your browser using DataLab