Title: | The R Interface to 'SyncroSim' |
---|---|
Description: | 'SyncroSim' is a generalized framework for managing scenario-based datasets (<https://syncrosim.com/>). 'rsyncrosim' provides an interface to 'SyncroSim'. Simulation models can be added to 'SyncroSim' in order to transform these datasets, taking advantage of general features such as defining scenarios of model inputs, running Monte Carlo simulations, and summarizing model outputs. 'rsyncrosim' requires 'SyncroSim' 2.3.5 or higher (API documentation: <https://docs.syncrosim.com/>). |
Authors: | Colin Daniel [aut], Josie Hughes [aut], Valentin Lucet [aut], Alex Embrey [aut], Katie Birchard [aut, cre], Leonardo Frid [aut], Tabitha Kennedy [aut], Shreeram Senthivasan [aut], ApexRMS [cph] |
Maintainer: | Katie Birchard <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.0.2 |
Built: | 2024-11-19 01:36:15 UTC |
Source: | https://github.com/syncrosim/rsyncrosim |
Adds package(s) to a SsimLibrary
.
addPackage(ssimLibrary, packages, versions = NULL, forceUpdate = FALSE) ## S4 method for signature 'character' addPackage(ssimLibrary, packages, versions = NULL, forceUpdate = FALSE) ## S4 method for signature 'SsimLibrary' addPackage(ssimLibrary, packages, versions = NULL, forceUpdate = FALSE)
addPackage(ssimLibrary, packages, versions = NULL, forceUpdate = FALSE) ## S4 method for signature 'character' addPackage(ssimLibrary, packages, versions = NULL, forceUpdate = FALSE) ## S4 method for signature 'SsimLibrary' addPackage(ssimLibrary, packages, versions = NULL, forceUpdate = FALSE)
ssimLibrary |
|
packages |
character string or vector of package name(s) |
versions |
character string or vector of package version(s). If
|
forceUpdate |
logical. If |
Invisibly returns TRUE
upon success (i.e.successful addition
of the package) or FALSE
upon failure.
## Not run: # Install "stsim" and "stsimecodep" SyncroSim packages installPackage(packages = c("stsim", "stsim"), versions = c("4.0.0", "4.0.1")) installPackage("stsimecodep") # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Add package addPackage(myLibrary, packages = "stsim", versions = "4.0.1") addPackage(myLibrary, packages = "stsimecodep") packages(myLibrary) # Change package version addPackage(myLibrary, packages = "stsim", versions = "4.0.0") addPackage(myLibrary, packages = "stsim", versions = "4.0.1") # Remove package removePackage(myLibrary, packages = c("stsim", "stsimecodep")) packages(myLibrary) ## End(Not run)
## Not run: # Install "stsim" and "stsimecodep" SyncroSim packages installPackage(packages = c("stsim", "stsim"), versions = c("4.0.0", "4.0.1")) installPackage("stsimecodep") # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Add package addPackage(myLibrary, packages = "stsim", versions = "4.0.1") addPackage(myLibrary, packages = "stsimecodep") packages(myLibrary) # Change package version addPackage(myLibrary, packages = "stsim", versions = "4.0.0") addPackage(myLibrary, packages = "stsim", versions = "4.0.1") # Remove package removePackage(myLibrary, packages = c("stsim", "stsimecodep")) packages(myLibrary) ## End(Not run)
This function is mostly used internally to add rows to data.frames associated with SyncroSim Datasheets retrieved from the command line.
addRow(targetDataframe, value) ## S4 method for signature 'data.frame' addRow(targetDataframe, value)
addRow(targetDataframe, value) ## S4 method for signature 'data.frame' addRow(targetDataframe, value)
targetDataframe |
data.frame |
value |
data.frame, character string, vector, or list. Columns or elements in value should be a subset of columns in targetDataframe |
Preserves the types and factor levels of the targetDataframe. Fills missing values if possible using factor levels. If value is a named vector or list, it will be converted to a single row data.frame. If value is an unnamed vector or list, the number of elements should equal the number of columns in the targetDataframe; elements are assumed to be in same order as data.frame columns.
A dataframe with new rows.
# Create an example data.frame oldDataframe <- as.data.frame(mtcars) # Add a single row to the example data.frame newDataframe <- addRow(oldDataframe, list(mpg = 100, wt = 10)) # Create an example data.frame with more than one row of data multipleRows <- data.frame(mpg = c(40, 50, 75), wt = c(4, 7, 6)) # Add the old example data.frame to the new example data.frame newDataframe <- addRow(oldDataframe, multipleRows)
# Create an example data.frame oldDataframe <- as.data.frame(mtcars) # Add a single row to the example data.frame newDataframe <- addRow(oldDataframe, list(mpg = 100, wt = 10)) # Create an example data.frame with more than one row of data multipleRows <- data.frame(mpg = c(40, 50, 75), wt = c(4, 7, 6)) # Add the old example data.frame to the new example data.frame newDataframe <- addRow(oldDataframe, multipleRows)
Backup a SsimLibrary
. The backup folder can be defined in the
SyncroSim User Interface, but is by default at the same level as the
SsimLibrary file, and is called libraryName.backup.
backup(ssimObject) ## S4 method for signature 'character' backup(ssimObject) ## S4 method for signature 'SsimObject' backup(ssimObject)
backup(ssimObject) ## S4 method for signature 'character' backup(ssimObject) ## S4 method for signature 'SsimObject' backup(ssimObject)
ssimObject |
|
Invisibly returns TRUE
upon success (i.e.successful
backup) and FALSE
upon failure.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Back up data from the SsimLibrary backup(myLibrary) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Back up data from the SsimLibrary backup(myLibrary) ## End(Not run)
Create or open a Chart
from a SyncroSim
Project
.
chart(ssimObject = NULL, chart = NULL, create = FALSE, summary = FALSE)
chart(ssimObject = NULL, chart = NULL, create = FALSE, summary = FALSE)
ssimObject |
|
chart |
character or integer. If character, then will either open an
existing chart if |
create |
logical. Whether to create a new chart if the chart name given
already exists in the SyncroSim library. If |
summary |
logical. If |
A Chart
object representing a SyncroSim chart
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim") myProject <- project(myLibrary, project = "My Project") myScenario <- scenario(myProject, scenario = "My Scenario") # Create a new chart myChart <- chart(myProject, chart = "New Chart") ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim") myProject <- project(myLibrary, project = "My Project") myScenario <- scenario(myProject, scenario = "My Scenario") # Create a new chart myChart <- chart(myProject, chart = "New Chart") ## End(Not run)
Chart
object representing a SyncroSim Chart object. A Chart object
is used to create line or column charts from tabular output data in the
and can be viewed using the SyncroSim User Interface.
session
Session
object. The Session associated with the
Chart's SsimLibrary
filepath
character string. The path to the Chart's SsimLibrary on disk
chartId
integer. The Chart id
projectId
integer. The Project id
See chart
for options when creating or loading a
SyncroSim Chart
Retrieves the available variables for charting, or the variables that are set for an existing chart.
chartCriteria(ssimObject, chart = NULL, variable = NULL, filter = NULL) ## S4 method for signature 'SsimObject' chartCriteria(ssimObject, chart = NULL, variable = NULL, filter = NULL)
chartCriteria(ssimObject, chart = NULL, variable = NULL, filter = NULL) ## S4 method for signature 'SsimObject' chartCriteria(ssimObject, chart = NULL, variable = NULL, filter = NULL)
ssimObject |
|
chart |
character or integer. Either the name or ID of an existing chart.
If |
variable |
character. The name of a charting variable. If provided,
then will return a list of the available filter columns for that variable.
Default is |
filter |
character. The name of a filter column for a specified
variable. If provided, then will return a list of values that pertain to
the specified filter. If the filter column is used to disaggregate the
chart data (using the |
Example arguments:
If ssimObject is SyncroSim Project and chart is NULL
: Returns
a data.frame of available variables for creating a new chart.
If ssimObject is SyncroSIm Chart or chart is not NULL
: Returns
a data.frame of variables in use by the specified chart.
If variable is not NULL
: Returns a list of filter columns
that belong to the given variable.
If variable and filter are not NULL
: Returns a dataframe of
value IDs and names that belong to the given variable and filter.
A data.frame or list of variables, filter columns, and filter values.
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Retrieve variables that can be used to create new charts chartCriteria(myProject) # Retrieve variables being used by existing chart chartCriteria(myChart) ## End(Not run)
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Retrieve variables that can be used to create new charts chartCriteria(myProject) # Retrieve variables being used by existing chart chartCriteria(myChart) ## End(Not run)
Chart
type and axesSets the Chart
type and adds the variables to plot
in the line chart.
chartData( chart, type = "Line", addX = NULL, addY = NULL, removeX = NULL, removeY = NULL, timesteps = NULL, iterationType = "Mean", iteration = 1 ) ## S4 method for signature 'Chart' chartData( chart, type = "Line", addX = NULL, addY = NULL, removeX = NULL, removeY = NULL, timesteps = NULL, iterationType = "Mean", iteration = 1 )
chartData( chart, type = "Line", addX = NULL, addY = NULL, removeX = NULL, removeY = NULL, timesteps = NULL, iterationType = "Mean", iteration = 1 ) ## S4 method for signature 'Chart' chartData( chart, type = "Line", addX = NULL, addY = NULL, removeX = NULL, removeY = NULL, timesteps = NULL, iterationType = "Mean", iteration = 1 )
chart |
|
type |
character. Chart type. Can be "Line" (Default) or "Column". |
addX |
character or character vector. X variable(s) to add to the chart.
If |
addY |
character or character vector. Y variable(s) to add to the chart.
If |
removeX |
character or character vector. X variable(s) to remove from
plot. If |
removeY |
character or character vector. Y variable(s) to remove from
plot. If |
timesteps |
integer vector. The range of timesteps to plot against
If |
iterationType |
character. How to display multiple iterations in the chart. Can be "Mean" (Default), "Single", or "All". |
iteration |
integer. If the |
A Chart
object representing a SyncroSim chart
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Set the chart type and data myChart <- chartData(myChart, y = c("variable1", "variable2"), timesteps = c(0,10), iterationType = "single", iteration = 1) ## End(Not run)
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Set the chart type and data myChart <- chartData(myChart, y = c("variable1", "variable2"), timesteps = c(0,10), iterationType = "single", iteration = 1) ## End(Not run)
Chart
by a Y variableDisaggregates the Chart
by given filter column(s) in a Y
variable.
chartDisagg(chart, variable, addFilter = NULL, removeFilter = NULL) ## S4 method for signature 'Chart' chartDisagg(chart, variable, addFilter = NULL, removeFilter = NULL)
chartDisagg(chart, variable, addFilter = NULL, removeFilter = NULL) ## S4 method for signature 'Chart' chartDisagg(chart, variable, addFilter = NULL, removeFilter = NULL)
chart |
|
variable |
character. The variable to disaggregate the Y axis by. |
addFilter |
character or character vector. Adds Y variable column(s) to disaggregate the chart by. |
removeFilter |
character or character vector. Removes Y variable column(s) from disaggregating the chart. |
A Chart
object representing a SyncroSim chart
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Set the chart type and data myChart <- chartData(myChart, y = c("variable1", "variable2"), timesteps = c(0,10), iterationType = "single", iteration = 1) # Disaggregate the chart by a filter column myChart <- chartDisagg(myChart, variable = "variable1", addFilter=c("col1", "col2")) # Remove a filter column from the chart disaggregation myChart <- chartDisagg(myChart, variable = "variable1", removeFilter="col1") ## End(Not run)
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Set the chart type and data myChart <- chartData(myChart, y = c("variable1", "variable2"), timesteps = c(0,10), iterationType = "single", iteration = 1) # Disaggregate the chart by a filter column myChart <- chartDisagg(myChart, variable = "variable1", addFilter=c("col1", "col2")) # Remove a filter column from the chart disaggregation myChart <- chartDisagg(myChart, variable = "variable1", removeFilter="col1") ## End(Not run)
Chart
Set the type and properties of the error bars of a Chart
.
chartErrorBar(chart, type = NULL, lower = NULL, upper = NULL) ## S4 method for signature 'Chart' chartErrorBar(chart, type = NULL, lower = NULL, upper = NULL)
chartErrorBar(chart, type = NULL, lower = NULL, upper = NULL) ## S4 method for signature 'Chart' chartErrorBar(chart, type = NULL, lower = NULL, upper = NULL)
chart |
|
type |
character. Type of error bar. Values can be "percentile", "minmax", or "none". Default is NULL. |
lower |
float. If the error bar type is set to "percentile", then
sets the minimum percentile for the lower range of the error bar. Default is
|
upper |
float. If the error bar type is set to "percentile", then
sets the maximum percentile for the upper range of the error bar. Default is
|
A Chart
object representing a SyncroSim chart or, if no arguments
other than the chart are provided, a data.frame of the current chart error
bar settings.
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the chart error bars to display the minimum/maximum of the data myChart <- chartErrorBar(myChart, type = "minmax") # Disable the chart error bars myChart <- chartErrorBar(myChart, type = "none") # Set the chart error bars to display the 95th percentile error bars myChart <- chartErrorBar(myChart, type = "percentile", lower = 2.5, upper = 97.5) ## End(Not run)
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the chart error bars to display the minimum/maximum of the data myChart <- chartErrorBar(myChart, type = "minmax") # Disable the chart error bars myChart <- chartErrorBar(myChart, type = "none") # Set the chart error bars to display the 95th percentile error bars myChart <- chartErrorBar(myChart, type = "percentile", lower = 2.5, upper = 97.5) ## End(Not run)
Retrieves the Chart Id of a SyncroSim Chart
.
chartId(ssimObject) ## S4 method for signature 'character' chartId(ssimObject) ## S4 method for signature 'Chart' chartId(ssimObject)
chartId(ssimObject) ## S4 method for signature 'character' chartId(ssimObject) ## S4 method for signature 'Chart' chartId(ssimObject)
ssimObject |
|
An integer: chart id.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set the SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim", overwrite = TRUE) myProject <- project(myLibrary, project = "Definitions") # Get the chart object corresponding to the chart called "My Chart" myChart <- chart(myProject, chart = "My Chart") # Get Chart ID for SyncroSim Chart chartId(myChart) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set the SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim", overwrite = TRUE) myProject <- project(myLibrary, project = "Definitions") # Get the chart object corresponding to the chart called "My Chart" myChart <- chart(myProject, chart = "My Chart") # Get Chart ID for SyncroSim Chart chartId(myChart) ## End(Not run)
Chart
Add or remove values by a specified column in the X or Y axis of a
Chart
.
chartInclude( chart, variable, filter, axis = "Y", addValue = NULL, removeValue = NULL ) ## S4 method for signature 'Chart' chartInclude( chart, variable, filter, axis = "Y", addValue = NULL, removeValue = NULL )
chartInclude( chart, variable, filter, axis = "Y", addValue = NULL, removeValue = NULL ) ## S4 method for signature 'Chart' chartInclude( chart, variable, filter, axis = "Y", addValue = NULL, removeValue = NULL )
chart |
|
variable |
character. A variable belonging to the X or Y axis. |
filter |
character or character vector. A filter column belonging to the X or Y variable. |
axis |
character. Either "X" or "Y" corresponding to the X or Y axis of the chart. Default is "Y". |
addValue |
character or character vector. Adds value(s) from the specified filter column and X or Y variable to be included in the chart. |
removeValue |
character or character vector. Removes value(s) from the specified filter column and X or Y variable from being included in the chart. |
A Chart
object representing a SyncroSim chart
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Set the chart type and data myChart <- chartData(myChart, y = c("variable1", "variable2"), timesteps = c(0,10), iterationType = "single", iteration = 1) # Include specific values in the chart myChart <- chartInclude(myChart, variable = "variable1", filter="col1", addValue=c("val1", "val2", "val3")) # Remove specific values from the chart myChart <- chartInclude(myChart, variable = "variable1", filter="col1", removeValue="val3") ## End(Not run)
## Not run: # Create a chart object myChart <- chart(myProject, chart = "New Chart") # Set the chart type and data myChart <- chartData(myChart, y = c("variable1", "variable2"), timesteps = c(0,10), iterationType = "single", iteration = 1) # Include specific values in the chart myChart <- chartInclude(myChart, variable = "variable1", filter="col1", addValue=c("val1", "val2", "val3")) # Remove specific values from the chart myChart <- chartInclude(myChart, variable = "variable1", filter="col1", removeValue="val3") ## End(Not run)
Chart
Modifies the font style and size of various Chart
components.
chartOptionsFont( chart, titleFont = NULL, titleStyle = NULL, titleSize = NULL, panelFont = NULL, panelStyle = NULL, panelSize = NULL, axisFont = NULL, axisStyle = NULL, axisSize = NULL, legendFont = NULL, legendStyle = NULL, legendSize = NULL ) ## S4 method for signature 'Chart' chartOptionsFont( chart, titleFont = NULL, titleStyle = NULL, titleSize = NULL, panelFont = NULL, panelStyle = NULL, panelSize = NULL, axisFont = NULL, axisStyle = NULL, axisSize = NULL, legendFont = NULL, legendStyle = NULL, legendSize = NULL )
chartOptionsFont( chart, titleFont = NULL, titleStyle = NULL, titleSize = NULL, panelFont = NULL, panelStyle = NULL, panelSize = NULL, axisFont = NULL, axisStyle = NULL, axisSize = NULL, legendFont = NULL, legendStyle = NULL, legendSize = NULL ) ## S4 method for signature 'Chart' chartOptionsFont( chart, titleFont = NULL, titleStyle = NULL, titleSize = NULL, panelFont = NULL, panelStyle = NULL, panelSize = NULL, axisFont = NULL, axisStyle = NULL, axisSize = NULL, legendFont = NULL, legendStyle = NULL, legendSize = NULL )
chart |
|
titleFont |
character. Sets the font for the title of the
chart axes (e.g., "Microsoft Sans Serif, "Times New Roman", "Arial Narrow").
Default is |
titleStyle |
character. Sets the font style for the title. Values can be
"standard", "italic", "bold", or "bold/italic". Default is |
titleSize |
integer. Sets the font size for the title of the
chart axes. Default is |
panelFont |
character. Sets the font for the title of the chart
panels (e.g., "Microsoft Sans Serif, "Times New Roman", "Arial"). Default
is |
panelStyle |
character. Sets the font style for the chart panels. Values
can be "standard", "italic", "bold", or "bold/italic". Default is |
panelSize |
integer. Sets the font size for the chart panels. Default is
|
axisFont |
character. Sets the font for the title of the chart
panel axes (e.g., "Microsoft Sans Serif, "Times New Roman", "Arial"). Default
is |
axisStyle |
character. Sets the font style for the chart panel axes. Values
can be "standard", "italic", "bold", or "bold/italic". Default is |
axisSize |
integer. Sets the font size for the chart panel axes. Default
is |
legendFont |
character. Sets the font for the title of the
chart legend (e.g., "Microsoft Sans Serif, "Times New Roman", "Arial"). Default
is |
legendStyle |
character. Sets the font style for the chart legend. Values
can be "standard", "italic", "bold", or "bold/italic". Default is |
legendSize |
integer. Sets the font size for the chart legend. Default
is |
A Chart
object representing a SyncroSim chart or, if no arguments
other than the chart are provided, a data.frame of the current chart font
settings.
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the font for the chart panels myChart <- chartOptionsFont(myChart, panelFont = "Microsoft Sans Serif", panelStyle = "bold/italic", panelSize = 8) # Return a dataframe of the current font settings myChart <- chartOptionsFont(myChart) ## End(Not run)
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the font for the chart panels myChart <- chartOptionsFont(myChart, panelFont = "Microsoft Sans Serif", panelStyle = "bold/italic", panelSize = 8) # Return a dataframe of the current font settings myChart <- chartOptionsFont(myChart) ## End(Not run)
Chart
Modifies the font style and size of various Chart
components.
chartOptionsFormat( chart, noDataAsZero = NULL, showDataPoints = NULL, showDataPointsOnly = NULL, showPanelTitles = NULL, showToolTips = NULL, showNoDataPanels = NULL, lineWidth = NULL ) ## S4 method for signature 'Chart' chartOptionsFormat( chart, noDataAsZero = NULL, showDataPoints = NULL, showDataPointsOnly = NULL, showPanelTitles = NULL, showToolTips = NULL, showNoDataPanels = NULL, lineWidth = NULL )
chartOptionsFormat( chart, noDataAsZero = NULL, showDataPoints = NULL, showDataPointsOnly = NULL, showPanelTitles = NULL, showToolTips = NULL, showNoDataPanels = NULL, lineWidth = NULL ) ## S4 method for signature 'Chart' chartOptionsFormat( chart, noDataAsZero = NULL, showDataPoints = NULL, showDataPointsOnly = NULL, showPanelTitles = NULL, showToolTips = NULL, showNoDataPanels = NULL, lineWidth = NULL )
chart |
|
noDataAsZero |
logical. Determines whether NA, Null and No Data values
should be charted as zero. Default is |
showDataPoints |
logical. Determines whether each data point should be
displayed with a point (i.e., circle). Default is |
showDataPointsOnly |
logical. Determines whether only points should be
displayed (i.e., no line in the line charts). Default is |
showPanelTitles |
logical. Determines whether to show a title above each
panel. Default is |
showToolTips |
logical. Determines whether to show the tool tip when
hovering the cursor over a data point. Default is |
showNoDataPanels |
logical. Determines whether to show chart panels
with no data. Default is |
lineWidth |
integer. Sets the charts' line thickness. Default
is |
A Chart
object representing a SyncroSim chart or, if no arguments
other than the chart are provided, a data.frame of the current chart format
settings.
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the format for the chart panels myChart <- chartOptionsFormat(myChart, noDataAsZero = TRUE, showDataPoints = FALSE, showDataPointsOnly = FALSE, showPanelTitles = TRUE, showToolTips = TRUE, showNoDataPanels = FALSE, lineWidth = 1) # Return a dataframe of the current font settings myChart <- chartOptionsFormat(myChart) ## End(Not run)
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the format for the chart panels myChart <- chartOptionsFormat(myChart, noDataAsZero = TRUE, showDataPoints = FALSE, showDataPointsOnly = FALSE, showPanelTitles = TRUE, showToolTips = TRUE, showNoDataPanels = FALSE, lineWidth = 1) # Return a dataframe of the current font settings myChart <- chartOptionsFormat(myChart) ## End(Not run)
Chart
Modifies the legend settings for a Chart
.
chartOptionsLegend( chart, show = NULL, showScenarioName = NULL, showScenarioId = NULL, showStageName = NULL, showTimestamp = NULL ) ## S4 method for signature 'Chart' chartOptionsLegend( chart, show = NULL, showScenarioName = NULL, showScenarioId = NULL, showStageName = NULL, showTimestamp = NULL )
chartOptionsLegend( chart, show = NULL, showScenarioName = NULL, showScenarioId = NULL, showStageName = NULL, showTimestamp = NULL ) ## S4 method for signature 'Chart' chartOptionsLegend( chart, show = NULL, showScenarioName = NULL, showScenarioId = NULL, showStageName = NULL, showTimestamp = NULL )
chart |
|
show |
logical. Whether to show the chart legend. Default is |
showScenarioName |
logical. Whether to show the scenario name in the
legend. Default is |
showScenarioId |
logical. Whether to show the scenario ID in the legend.
Default is |
showStageName |
logical. Determines whether to show the stage name
(i.e., transformer name) in the legend. Default is |
showTimestamp |
logical. Whether to show the timestamp of the scenario
run in the legend. Default is |
A Chart
object representing a SyncroSim chart or, if no arguments
other than the chart are provided, a data.frame of the current chart legend
settings.
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Remove the scenario ID and the timestamp from the chart myChart <- chartOptionsLegend(myChart, showScenarioId = FALSE, showTimestamp = FALSE) # Hide the chart legend myChart <- chartOptionsLegend(myChart, show = FALSE) ## End(Not run)
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Remove the scenario ID and the timestamp from the chart myChart <- chartOptionsLegend(myChart, showScenarioId = FALSE, showTimestamp = FALSE) # Hide the chart legend myChart <- chartOptionsLegend(myChart, show = FALSE) ## End(Not run)
Chart
Set the title and style of the X Axis of a Chart
.
chartOptionsXAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL ) ## S4 method for signature 'Chart' chartOptionsXAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL )
chartOptionsXAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL ) ## S4 method for signature 'Chart' chartOptionsXAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL )
chart |
|
title |
character. Title of the X Axis. Default is |
numberStyle |
character. Sets the style for the axes labels. Options
include "number", scientific", or "currency". Default is |
decimals |
float. Sets the number of decimal places to be displayed in
the axes labels. Values can be between 0 and 8. Default is |
thousandsSeparator |
logical. Whether to use a thousand separator
(i.e., 1,000,000). Default is |
A Chart
object representing a SyncroSim chart or, if no arguments
other than the chart are provided, a data.frame of the current chart X Axis
settings.
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the chart X Axis title myChart <- chartOptionsXAxis(myChart, title = "Year") # Return a dataframe of the current X Axis settings myChart <- chartOptionsXAxis(myChart) ## End(Not run)
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the chart X Axis title myChart <- chartOptionsXAxis(myChart, title = "Year") # Return a dataframe of the current X Axis settings myChart <- chartOptionsXAxis(myChart) ## End(Not run)
Chart
Set the title and style of the Y axis of a Chart
.
chartOptionsYAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL, minZero = NULL, sameScale = NULL, fixedIntervals = NULL ) ## S4 method for signature 'Chart' chartOptionsYAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL, minZero = NULL, sameScale = NULL, fixedIntervals = NULL )
chartOptionsYAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL, minZero = NULL, sameScale = NULL, fixedIntervals = NULL ) ## S4 method for signature 'Chart' chartOptionsYAxis( chart, title = NULL, numberStyle = NULL, decimals = NULL, thousandsSeparator = NULL, minZero = NULL, sameScale = NULL, fixedIntervals = NULL )
chart |
|
title |
character. Title of the Y axis. Default is |
numberStyle |
character. Sets the style for the axes labels. Options
include "number", scientific", or "currency". Default is |
decimals |
float. Sets the number of decimal places to be displayed in
the axes labels. Values can be between 0 and 8. Default is |
thousandsSeparator |
logical. Whether to use a thousand separator
(i.e., 1,000,000). Default is |
minZero |
logical. Whether the minimum value displayed in the Y axis should be zero. |
sameScale |
logical. Whether the Y axis scale should be consistent
across chart panels. Default is |
fixedIntervals |
logical. Whether the interval between Y axis labels
should be consistent across chart panels. Default is |
A Chart
object representing a SyncroSim chart or, if no arguments
other than the chart are provided, a data.frame of the current chart Y axis
settings.
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the chart Y axis title myChart <- chartOptionsYAxis(myChart, title = "Year") # Return a dataframe of the current Y axis settings myChart <- chartOptionsYAxis(myChart) ## End(Not run)
## Not run: # Open a chart object myChart <- chart(myProject, chart = "My Chart") # Set the chart Y axis title myChart <- chartOptionsYAxis(myChart, title = "Year") # Return a dataframe of the current Y axis settings myChart <- chartOptionsYAxis(myChart) ## End(Not run)
This function issues a command to the SyncroSim console, and is mostly used internally by other functions.
command( args, session = NULL, program = "SyncroSim.Console.exe", wait = TRUE, progName = NULL )
command( args, session = NULL, program = "SyncroSim.Console.exe", wait = TRUE, progName = NULL )
args |
character string, named list, named vector, unnamed list, or unnamed vector. Arguments for the SyncroSim console. See 'details' for more information about this argument |
session |
|
program |
character. The name of the target SyncroSim executable. Options include "SyncroSim.Console.exe" (default), "SyncroSim.VizConsole.exe", "SyncroSim.PackageManager.exe" and "SyncroSim.Multiband.exe" |
wait |
logical. If |
progName |
character. Internal argument for setting path to SyncroSim installation folder. |
Example args, and the resulting character string passed to the SyncroSim console:
Character string e.g. "–create –help": "–create –help"
Named list or named vector e.g. list(name1=NULL,name2=value2): "–name1 –name2=value2"
Unnamed list or unnamed vector e.g. c("create","help"): "–create –help"
Character string: output from the SyncroSim program.
## Not run: # Install "stsim" if not already installed installPackage("stsim") # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib.ssim") # Specify the command line arguments for creating a new stsim SsimLibrary args <- list(create = NULL, library = NULL, name = myLibraryName, package = "stsim") # Use a default session to create a new SsimLibrary in the current working directory output <- command(args, session = session(printCmd = TRUE)) output # Provide arguments to the command line using an unnamed vector command(c("create", "help")) # Provide arguments to the command line using a character string command("--create --help") # Provide arguments to the command line using a named list command(list(create = NULL, help = NULL)) # Call on a different program to find all installed packages command(list(installed = NULL), program = "SyncroSim.PackageManager.exe") ## End(Not run)
## Not run: # Install "stsim" if not already installed installPackage("stsim") # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib.ssim") # Specify the command line arguments for creating a new stsim SsimLibrary args <- list(create = NULL, library = NULL, name = myLibraryName, package = "stsim") # Use a default session to create a new SsimLibrary in the current working directory output <- command(args, session = session(printCmd = TRUE)) output # Provide arguments to the command line using an unnamed vector command(c("create", "help")) # Provide arguments to the command line using a character string command("--create --help") # Provide arguments to the command line using a named list command(list(create = NULL, help = NULL)) # Call on a different program to find all installed packages command(list(installed = NULL), program = "SyncroSim.PackageManager.exe") ## End(Not run)
Gets or sets the path to the Conda installation folder. Can be used to direct SyncroSim to a custom Conda installation.
condaFilepath(session) ## S4 method for signature 'Session' condaFilepath(session) ## S4 method for signature 'missingOrNULLOrChar' condaFilepath(session) condaFilepath(session) <- value ## S4 replacement method for signature 'character' condaFilepath(session) <- value ## S4 replacement method for signature 'Session' condaFilepath(session) <- value
condaFilepath(session) ## S4 method for signature 'Session' condaFilepath(session) ## S4 method for signature 'missingOrNULLOrChar' condaFilepath(session) condaFilepath(session) <- value ## S4 replacement method for signature 'character' condaFilepath(session) <- value ## S4 replacement method for signature 'Session' condaFilepath(session) <- value
session |
|
value |
character. If empty, then returns the current Conda installation path |
A character: the currently set filepath of the Conda installation folder.
## Not run: # Set up a SyncroSim Session mySession <- session() # Retrieve Conda installation path for the SyncroSim Session condaFilepath(mySession) # Set the Conda installation path for the SyncroSim Session condaFilepath(mySession) <- "C:/miniconda3" ## End(Not run)
## Not run: # Set up a SyncroSim Session mySession <- session() # Retrieve Conda installation path for the SyncroSim Session condaFilepath(mySession) # Set the Conda installation path for the SyncroSim Session condaFilepath(mySession) <- "C:/miniconda3" ## End(Not run)
Creates the conda environment for the specified SyncroSim package(s).
createCondaEnv(pkgs, session = NULL) ## S4 method for signature 'ANY,character' createCondaEnv(pkgs, session = NULL) ## S4 method for signature 'ANY,missingOrNULL' createCondaEnv(pkgs, session = NULL) ## S4 method for signature 'ANY,Session' createCondaEnv(pkgs, session = NULL)
createCondaEnv(pkgs, session = NULL) ## S4 method for signature 'ANY,character' createCondaEnv(pkgs, session = NULL) ## S4 method for signature 'ANY,missingOrNULL' createCondaEnv(pkgs, session = NULL) ## S4 method for signature 'ANY,Session' createCondaEnv(pkgs, session = NULL)
pkgs |
character or list of characters. |
session |
|
Invisibly returns TRUE
upon success (i.e.successful creation of the
conda environment(s)) or FALSE
upon failure.
## Not run: # Set up a SyncroSim Session mySession <- session() # Create the conda environment for helloworldConda package condaFilepath(pkgs = "helloworldConda", mySession) ## End(Not run)
## Not run: # Set up a SyncroSim Session mySession <- session() # Create the conda environment for helloworldConda package condaFilepath(pkgs = "helloworldConda", mySession) ## End(Not run)
This function retrieves a SyncroSim Datasheet, either by calling the SyncroSim
console, or by directly querying the SsimLibrary
database.
datasheet( ssimObject, name = NULL, project = NULL, scenario = NULL, summary = NULL, optional = FALSE, empty = FALSE, filterColumn = NULL, filterValue = NULL, lookupsAsFactors = TRUE, sqlStatement = list(select = "SELECT *", groupBy = ""), includeKey = FALSE, forceElements = FALSE, fastQuery = FALSE, returnScenarioInfo = FALSE, returnInvisible = FALSE, rawValues = FALSE, verbose = TRUE ) ## S4 method for signature 'list' datasheet( ssimObject, name = NULL, project = NULL, scenario = NULL, summary = NULL, optional = FALSE, empty = FALSE, filterColumn = NULL, filterValue = NULL, lookupsAsFactors = TRUE, sqlStatement = list(select = "SELECT *", groupBy = ""), includeKey = FALSE, forceElements = FALSE, fastQuery = FALSE, returnScenarioInfo = FALSE, returnInvisible = FALSE, rawValues = FALSE, verbose = TRUE ) ## S4 method for signature 'character' datasheet( ssimObject, name, project, scenario, summary, optional, empty, filterColumn, filterValue, lookupsAsFactors, sqlStatement, includeKey, fastQuery, returnScenarioInfo, returnInvisible, rawValues, verbose ) ## S4 method for signature 'SsimObject' datasheet( ssimObject, name = NULL, project = NULL, scenario = NULL, summary = NULL, optional = FALSE, empty = FALSE, filterColumn = NULL, filterValue = NULL, lookupsAsFactors = TRUE, sqlStatement = list(select = "SELECT *", groupBy = ""), includeKey = FALSE, forceElements = FALSE, fastQuery = FALSE, returnScenarioInfo = FALSE, returnInvisible = FALSE, rawValues = FALSE, verbose = TRUE )
datasheet( ssimObject, name = NULL, project = NULL, scenario = NULL, summary = NULL, optional = FALSE, empty = FALSE, filterColumn = NULL, filterValue = NULL, lookupsAsFactors = TRUE, sqlStatement = list(select = "SELECT *", groupBy = ""), includeKey = FALSE, forceElements = FALSE, fastQuery = FALSE, returnScenarioInfo = FALSE, returnInvisible = FALSE, rawValues = FALSE, verbose = TRUE ) ## S4 method for signature 'list' datasheet( ssimObject, name = NULL, project = NULL, scenario = NULL, summary = NULL, optional = FALSE, empty = FALSE, filterColumn = NULL, filterValue = NULL, lookupsAsFactors = TRUE, sqlStatement = list(select = "SELECT *", groupBy = ""), includeKey = FALSE, forceElements = FALSE, fastQuery = FALSE, returnScenarioInfo = FALSE, returnInvisible = FALSE, rawValues = FALSE, verbose = TRUE ) ## S4 method for signature 'character' datasheet( ssimObject, name, project, scenario, summary, optional, empty, filterColumn, filterValue, lookupsAsFactors, sqlStatement, includeKey, fastQuery, returnScenarioInfo, returnInvisible, rawValues, verbose ) ## S4 method for signature 'SsimObject' datasheet( ssimObject, name = NULL, project = NULL, scenario = NULL, summary = NULL, optional = FALSE, empty = FALSE, filterColumn = NULL, filterValue = NULL, lookupsAsFactors = TRUE, sqlStatement = list(select = "SELECT *", groupBy = ""), includeKey = FALSE, forceElements = FALSE, fastQuery = FALSE, returnScenarioInfo = FALSE, returnInvisible = FALSE, rawValues = FALSE, verbose = TRUE )
ssimObject |
|
name |
character or character vector. Sheet name(s). If |
project |
numeric or numeric vector. One or more
|
scenario |
numeric or numeric vector. One or more
|
summary |
logical or character. If |
optional |
logical. If |
empty |
logical. If |
filterColumn |
character string. The column to filter a Datasheet by.
(e.g. "TransitionGroupId"). Note that to use the filterColumn argument,
you must also specify the filterValue argument. Default is |
filterValue |
character string or integer. The value to filter the
filterColumn by. To use the filterValue argument, you must also specify
the filterColumn argument. Default is |
lookupsAsFactors |
logical. If |
sqlStatement |
list returned by |
includeKey |
logical. If |
forceElements |
logical. If |
fastQuery |
logical. If |
returnScenarioInfo |
logical. If |
returnInvisible |
logical. If |
rawValues |
logical. If |
verbose |
logical. If set to |
If summary=TRUE
or summary=NULL
and name=NULL
a data.frame describing the
Datasheets is returned. If optional=TRUE
, columns include: scope
, packages
,
name
, displayName
, isSingle
, data
. data only displayed for
a SyncroSim Scenario
. dataInherited
and dataSource
columns
added if a Scenario has dependencies. If optional=FALSE
, columns include:
scope
, name
, displayName
. All other arguments are ignored.
Otherwise, for each element in name a Datasheet is returned as follows:
If lookupsAsFactors=TRUE
(default): Each column is given the correct
data type, and dependencies returned as factors with allowed values (levels).
A warning is issued if the lookup has not yet been set.
If empty=TRUE
: Each column is given the correct data type. Fast (1 less
console command).
If empty=FALSE
and lookupsAsFactors=FALSE
: Column types are not checked,
and the optional argument is ignored. Fast (1 less console command).
If SsimObject is a list of Scenario
or Project
objects (output from run
, Scenario
or
Project
): Adds ScenarioId/ProjectId column if appropriate.
If Scenario/Project is a vector: Adds ScenarioId/ProjectId column as necessary.
If requested Datasheet has Scenario scope and contains info from more
than one Scenario: ScenarioId/ScenarioName/ScenarioParent columns
identify the Scenario by name
, id
, and parent
(if a result Scenario).
If requested Datasheet has Project scope and contains info from more
than one Project: ProjectId/ProjectName columns identify the Project
by name
and id
If summary=TRUE
returns a data.frame of Datasheet names
and other information, otherwise returns a data.frame or list of these.
## Not run: # 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) ## End(Not run)
## Not run: # 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) ## End(Not run)
This function retrieves spatial columns from one or more SyncroSim
Scenario
Datasheets.
datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'character' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'list' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'SsimObject' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'Scenario' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE )
datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'character' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'list' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'SsimObject' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE ) ## S4 method for signature 'Scenario' datasheetSpatRaster( ssimObject, datasheet, column = NULL, scenario = NULL, iteration = NULL, timestep = NULL, filterColumn = NULL, filterValue = NULL, subset = NULL, forceElements = FALSE, pathOnly = FALSE )
ssimObject |
SsimLibrary/Project/Scenario object or list of Scenario objects. If
SsimLibrary/Project, then |
datasheet |
character string. The name of the Datasheet containing the raster data |
column |
character string. The name of the column in the datasheet containing
the file names for raster data. If |
scenario |
character string, integer, or vector of these. The Scenarios to include. Required if SsimObject is an SsimLibrary/Project, ignored if SsimObject is a list of Scenarios (optional) |
iteration |
integer, character string, or vector of integer/character strings.
Iteration(s) to include. If |
timestep |
integer, character string, or vector of integer/character string.
Timestep(s) to include. If |
filterColumn |
character string. The column to filter a Datasheet by.
(e.g. "TransitionGroupID"). Note that to use the filterColumn argument,
you must also specify a filterValue. Default is |
filterValue |
character string or integer. The value of the filterColumn
to filter the Datasheet by. To use the filterValue argument, you must
also specify a filterColumn. Default is |
subset |
logical expression indicating Datasheet rows to return. e.g. expression(grepl("Ts0001", Filename, fixed=T)). See subset() for details (optional) |
forceElements |
logical. If |
pathOnly |
logical. If |
The names of the returned SpatRaster contain metadata. For Datasheets without Filename this is:
paste0(<datasheet name>,".Scn",<scenario id>,".",<tif name>)
.
For Datasheets containing Filename this is:
paste0(<datasheet name>,".Scn",<scenario id>,".It",<iteration>,".Ts",<timestep>)
.
A SpatRaster object, or List. See terra package documentation for details.
## Not run: # Install the helloworldSpatial package from the server installPackage("helloworldSpatial") # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib_datasheetSpatRaster") # Set up a SyncroSim Session mySession <- session() # Use the example template library from helloworldSpatial myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "helloworldSpatial") # Set up Project and Scenario myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario to generate results resultScenario <- run(myScenario) # Extract specific Datasheet rasters by iteration and timestep resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "helloworldSpatial_IntermediateDatasheet", column = "OutputRasterFile", iteration = 3, timestep = 2 ) # Extract specific Datasheet SpatRasters using pattern matching resultDatasheet <- datasheet(resultScenario, name = "helloworldSpatial_IntermediateDatasheet") colnames(resultDatasheet) outputRasterPaths <- resultDatasheet$OutputRasterFile resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "helloworldSpatial_IntermediateDatasheet", column = "OutputRasterFile", subset = expression(grepl("ts20", outputRasterPaths, fixed = TRUE)) ) # Return the raster Datasheets as a SpatRaster list resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "helloworldSpatial_IntermediateDatasheet", column = "OutputRasterFile", forceElements = TRUE) # Filter for only rasters that fit specific criteria # Load the ST-Sim spatial example library installPackage("stsim") # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib_stsim_datasheet") # Set the SyncroSim Session mySession <- session() # Create a new SsimLibrary with the example template from ST-Sim myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim") myScenario <- scenario(myLibrary, scenario = 16) # Run Scenario to generate results resultScenario <- run(myScenario) resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "stsim_OutputSpatialState", timestep = 5, iteration = 5, filterColumn = "TransitionTypeID", filterValue = "Fire") ## End(Not run)
## Not run: # Install the helloworldSpatial package from the server installPackage("helloworldSpatial") # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib_datasheetSpatRaster") # Set up a SyncroSim Session mySession <- session() # Use the example template library from helloworldSpatial myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "helloworldSpatial") # Set up Project and Scenario myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario to generate results resultScenario <- run(myScenario) # Extract specific Datasheet rasters by iteration and timestep resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "helloworldSpatial_IntermediateDatasheet", column = "OutputRasterFile", iteration = 3, timestep = 2 ) # Extract specific Datasheet SpatRasters using pattern matching resultDatasheet <- datasheet(resultScenario, name = "helloworldSpatial_IntermediateDatasheet") colnames(resultDatasheet) outputRasterPaths <- resultDatasheet$OutputRasterFile resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "helloworldSpatial_IntermediateDatasheet", column = "OutputRasterFile", subset = expression(grepl("ts20", outputRasterPaths, fixed = TRUE)) ) # Return the raster Datasheets as a SpatRaster list resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "helloworldSpatial_IntermediateDatasheet", column = "OutputRasterFile", forceElements = TRUE) # Filter for only rasters that fit specific criteria # Load the ST-Sim spatial example library installPackage("stsim") # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib_stsim_datasheet") # Set the SyncroSim Session mySession <- session() # Create a new SsimLibrary with the example template from ST-Sim myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim") myScenario <- scenario(myLibrary, scenario = 16) # Run Scenario to generate results resultScenario <- run(myScenario) resultRaster <- datasheetSpatRaster(resultScenario, datasheet = "stsim_OutputSpatialState", timestep = 5, iteration = 5, filterColumn = "TransitionTypeID", filterValue = "Fire") ## End(Not run)
The most recent modification date of a SsimLibrary
,
Project
, Scenario
or Folder
.
dateModified(ssimObject) ## S4 method for signature 'character' dateModified(ssimObject) ## S4 method for signature 'SsimLibrary' dateModified(ssimObject) ## S4 method for signature 'Project' dateModified(ssimObject) ## S4 method for signature 'Scenario' dateModified(ssimObject) ## S4 method for signature 'Folder' dateModified(ssimObject)
dateModified(ssimObject) ## S4 method for signature 'character' dateModified(ssimObject) ## S4 method for signature 'SsimLibrary' dateModified(ssimObject) ## S4 method for signature 'Project' dateModified(ssimObject) ## S4 method for signature 'Scenario' dateModified(ssimObject) ## S4 method for signature 'Folder' dateModified(ssimObject)
ssimObject |
|
A character string: date and time of the most recent modification to the SsimObject provided as input.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Check the last date of modification of the SsimLibrary dateModified(myLibrary) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Check the last date of modification of the SsimLibrary dateModified(myLibrary) ## End(Not run)
Deletes one or more items. Note that this is irreversible.
delete( ssimObject, project = NULL, scenario = NULL, folder = NULL, chart = NULL, datasheet = NULL, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL ) ## S4 method for signature 'character' delete( ssimObject, project = NULL, scenario = NULL, folder = NULL, chart = NULL, datasheet = NULL, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL ) ## S4 method for signature 'SsimObject' delete(ssimObject, project, scenario, folder, chart, datasheet, force, session)
delete( ssimObject, project = NULL, scenario = NULL, folder = NULL, chart = NULL, datasheet = NULL, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL ) ## S4 method for signature 'character' delete( ssimObject, project = NULL, scenario = NULL, folder = NULL, chart = NULL, datasheet = NULL, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL ) ## S4 method for signature 'SsimObject' delete(ssimObject, project, scenario, folder, chart, datasheet, force, session)
ssimObject |
|
project |
character string, numeric, or vector of these. One or more
|
scenario |
character string, numeric, or vector of these. One or more
|
folder |
character string, numeric, or vector of these. One or more
|
chart |
character string, numeric, or vector of these. One or more
|
datasheet |
character string or vector of these. One or more datasheet names (optional) |
force |
logical. If |
removeBackup |
logical. If |
removePublish |
logical. If |
removeCustom |
logical. If |
session |
|
Invisibly returns a list of boolean values corresponding to each
input: TRUE
upon success (i.e.successful deletion) and FALSE
upon failure.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "a project") # Check the Projects associated with this SsimLibrary project(myLibrary) # Delete Project delete(myLibrary, project = "a project", force = TRUE) # Check that Project was successfully deleted from SsimLibrary project(myLibrary) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "a project") # Check the Projects associated with this SsimLibrary project(myLibrary) # Delete Project delete(myLibrary, project = "a project", force = TRUE) # Check that Project was successfully deleted from SsimLibrary project(myLibrary) ## End(Not run)
Deletes a SyncroSim library. Note this is irreversable.
deleteLibrary( ssimLibrary, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL ) ## S4 method for signature 'SsimLibrary' deleteLibrary(ssimLibrary, force, removeBackup, removePublish, removeCustom) ## S4 method for signature 'character' deleteLibrary( ssimLibrary, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL )
deleteLibrary( ssimLibrary, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL ) ## S4 method for signature 'SsimLibrary' deleteLibrary(ssimLibrary, force, removeBackup, removePublish, removeCustom) ## S4 method for signature 'character' deleteLibrary( ssimLibrary, force = FALSE, removeBackup = FALSE, removePublish = FALSE, removeCustom = FALSE, session = NULL )
ssimLibrary |
SsimLibrary or path to a library |
force |
Logical. If FALSE (default) prompt to confirm that the library should be deleted. This is irreversable. |
removeBackup |
logical. If |
removePublish |
logical. If TRUE, will remove the publish folder when deleting a library. Default is FALSE. |
removeCustom |
logical. If TRUE and custom folders have been configured
for a library, then will remove the custom publish and/or backup folders when
deleting a library. Note that the |
session |
Session |
"saved" or failure message.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and create SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Delete library from SsimObject deleteLibrary(myLibrary, force = TRUE, removeBackup = TRUE) # Create another library myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Delete library from path deleteLibrary(myLibraryName) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and create SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Delete library from SsimObject deleteLibrary(myLibrary, force = TRUE, removeBackup = TRUE) # Create another library myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Delete library from path deleteLibrary(myLibraryName) ## End(Not run)
List dependencies, set dependencies, or remove dependencies from a SyncroSim
Scenario
. Setting dependencies is a way of linking together
Scenario Datafeeds, such that a change in the Scenario that is the source
dependency will update the dependent Scenario as well.
dependency(ssimObject) ## S4 method for signature 'character' dependency(ssimObject) ## S4 method for signature 'Scenario' dependency(ssimObject) dependency(ssimObject) <- value ## S4 replacement method for signature 'Scenario' dependency(ssimObject) <- value
dependency(ssimObject) ## S4 method for signature 'character' dependency(ssimObject) ## S4 method for signature 'Scenario' dependency(ssimObject) dependency(ssimObject) <- value ## S4 replacement method for signature 'Scenario' dependency(ssimObject) <- value
ssimObject |
|
value |
|
If dependency==NULL
, other arguments are ignored, and set of existing dependencies
is returned in order of precedence (from highest to lowest precedence).
Otherwise, returns list of saved or error messages for each dependency of each
scenario.
Note that the order of dependencies can be important - dependencies added most recently take precedence over existing dependencies. So, dependencies included in the dependency argument take precedence over any other existing dependencies. If the dependency argument includes more than one element, elements are ordered from lowest to highest precedence.
A data.frame: all dependencies for a given Scenario
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and 2 Scenarios mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myNewScenario <- scenario(myProject, scenario = "my New Scenario") # Set myScenario as a dependency of myNewScenario dependency(myNewScenario) <- myScenario # Get all dependencies info dependency(myNewScenario) # Remove all dependencies dependency(myNewScenario) <- c() ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and 2 Scenarios mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myNewScenario <- scenario(myProject, scenario = "my New Scenario") # Set myScenario as a dependency of myNewScenario dependency(myNewScenario) <- myScenario # Get all dependencies info dependency(myNewScenario) # Remove all dependencies dependency(myNewScenario) <- c() ## End(Not run)
Get or set the description of a SsimLibrary
, Project
,
or Scenario
.
description(ssimObject) description(ssimObject) <- value ## S4 method for signature 'character' description(ssimObject) ## S4 method for signature 'SsimObject' description(ssimObject) ## S4 replacement method for signature 'character' description(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' description(ssimObject) <- value
description(ssimObject) description(ssimObject) <- value ## S4 method for signature 'character' description(ssimObject) ## S4 method for signature 'SsimObject' description(ssimObject) ## S4 replacement method for signature 'character' description(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' description(ssimObject) <- value
ssimObject |
|
value |
character string specifying the new description |
A character string: the description of the SsimObject
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") # Retrieve the description of the SyncroSim Project mydescription <- description(myProject) # Set the description of the SyncroSim Project description(myProject) <- "my description" ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") # Retrieve the description of the SyncroSim Project mydescription <- description(myProject) # Set the description of the SyncroSim Project description(myProject) <- "my description" ## End(Not run)
Retrieves the path to a SyncroSim Session
,
SsimLibrary
, Project
, Scenario
,
of Folder
on disk.
filepath(ssimObject) ## S4 method for signature 'character' filepath(ssimObject) ## S4 method for signature 'Session' filepath(ssimObject) ## S4 method for signature 'SsimObject' filepath(ssimObject) ## S4 method for signature 'Folder' filepath(ssimObject)
filepath(ssimObject) ## S4 method for signature 'character' filepath(ssimObject) ## S4 method for signature 'Session' filepath(ssimObject) ## S4 method for signature 'SsimObject' filepath(ssimObject) ## S4 method for signature 'Folder' filepath(ssimObject)
ssimObject |
|
A character string: the path to a SyncroSim object on disk.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Get the file path myFilePath <- filepath(myLibrary) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Get the file path myFilePath <- filepath(myLibrary) ## End(Not run)
Create or open a Folder
from a SyncroSim
Project
.
folder( ssimObject = NULL, folder = NULL, parentFolder = NULL, summary = FALSE, create = FALSE )
folder( ssimObject = NULL, folder = NULL, parentFolder = NULL, summary = FALSE, create = FALSE )
ssimObject |
|
folder |
character or integer. If character, then will either open an
existing folder if |
parentFolder |
character, integer, or SyncroSim Folder object. If not
|
summary |
logical. If |
create |
logical. Whether to create a new folder if the folder name given
already exists in the SyncroSim library. If |
A Folder
object representing a SyncroSim folder.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "My Project") myScenario <- scenario(myProject, scenario = "My Scenario") # Create a new folder myFolder <- folder(myProject, folder = "New Folder") # Create a nested folder within "New Folder" myNestedFolder <- folder(myProject, folder = "New Nested Folder", parentFolder = myFolder) # Retrieve a dataframe of all folders in a project folder(myProject) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "My Project") myScenario <- scenario(myProject, scenario = "My Scenario") # Create a new folder myFolder <- folder(myProject, folder = "New Folder") # Create a nested folder within "New Folder" myNestedFolder <- folder(myProject, folder = "New Nested Folder", parentFolder = myFolder) # Retrieve a dataframe of all folders in a project folder(myProject) ## End(Not run)
Folder
object representing a SyncroSim Folder. A Folder is used to
organize SyncroSim Scenarios within a Project
, and can be
nested within other Folders at the project-level. These are used mostly in
the SyncroSim User Interface.
session
Session
object. The Session associated with the
Folder's SsimLibrary
filepath
character string. The path to the Folder's SsimLibrary on disk
folderId
integer. The Folder id
parentId
integer. The parent Folder id (if the folder is nested)
projectId
integer. The Project id
See folder
for options when creating or loading a
SyncroSim Folder
Retrieves the Folder Id of a SyncroSim Folder
or
Scenario
. Can also use to set the Folder Id for a
Scenario
- this will move the Scenario
into the
desired folder in the SyncroSim User Interface.
folderId(ssimObject) ## S4 method for signature 'character' folderId(ssimObject) ## S4 method for signature 'Folder' folderId(ssimObject) ## S4 method for signature 'Scenario' folderId(ssimObject) folderId(ssimObject) <- value ## S4 replacement method for signature 'Scenario' folderId(ssimObject) <- value
folderId(ssimObject) ## S4 method for signature 'character' folderId(ssimObject) ## S4 method for signature 'Folder' folderId(ssimObject) ## S4 method for signature 'Scenario' folderId(ssimObject) folderId(ssimObject) <- value ## S4 replacement method for signature 'Scenario' folderId(ssimObject) <- value
ssimObject |
|
value |
integer of the folder ID to move the |
An integer: folder id.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, overwrite = TRUE) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myFolder <- folder(myProject, "New Folder") # Get Folder ID for SyncroSim Folder and Scenario folderId(myFolder) folderId(myScenario) # Move the Scenario into the newly created folder folderId(myScenario) <- folderId(myFolder) folderId(myScenario) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, overwrite = TRUE) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myFolder <- folder(myProject, "New Folder") # Get Folder ID for SyncroSim Folder and Scenario folderId(myFolder) folderId(myScenario) # Move the Scenario into the newly created folder folderId(myScenario) <- folderId(myFolder) folderId(myScenario) ## End(Not run)
Retrieves or sets the Datafeeds to ignore for a Scenario
.
ignoreDependencies(ssimObject) ## S4 method for signature 'character' ignoreDependencies(ssimObject) ## S4 method for signature 'Scenario' ignoreDependencies(ssimObject) ignoreDependencies(ssimObject) <- value ## S4 replacement method for signature 'character' ignoreDependencies(ssimObject) <- value ## S4 replacement method for signature 'Scenario' ignoreDependencies(ssimObject) <- value
ignoreDependencies(ssimObject) ## S4 method for signature 'character' ignoreDependencies(ssimObject) ## S4 method for signature 'Scenario' ignoreDependencies(ssimObject) ignoreDependencies(ssimObject) <- value ## S4 replacement method for signature 'character' ignoreDependencies(ssimObject) <- value ## S4 replacement method for signature 'Scenario' ignoreDependencies(ssimObject) <- value
ssimObject |
|
value |
character string of Datafeed names to be ignored, separated by commas (optional) |
A character string: Scenario Datafeeds that will be ignored.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # List the Datafeeds to ignore ignoreDependencies(myScenario) # Set Scenario Datafeeds to ignore ignoreDependencies(myScenario) <- "stsim_RunControl,stsim_TransitionTarget" ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # List the Datafeeds to ignore ignoreDependencies(myScenario) # Set Scenario Datafeeds to ignore ignoreDependencies(myScenario) <- "stsim_RunControl,stsim_TransitionTarget" ## End(Not run)
Retrieves some basic metadata about a SsimLibrary: Name, Owner, Last Modified, Size, Read Only, Data files, Publish files, Temporary files, Backup files, and Use conda.
info(ssimLibrary) ## S4 method for signature 'SsimLibrary' info(ssimLibrary)
info(ssimLibrary) ## S4 method for signature 'SsimLibrary' info(ssimLibrary)
ssimLibrary |
|
Returns a data.frame
with information on the properties of the SsimLibrary
object.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Get information about SsimLibrary info(myLibrary) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Get information about SsimLibrary info(myLibrary) ## End(Not run)
This function installs Miniconda to the default installation path
within the SyncroSim installation folder. If you already have Conda
installed in the non-default location, you can point SyncroSim towards
that installation using the condaFilepath
function.
installConda(session) ## S4 method for signature 'character' installConda(session) ## S4 method for signature 'missingOrNULL' installConda(session) ## S4 method for signature 'Session' installConda(session)
installConda(session) ## S4 method for signature 'character' installConda(session) ## S4 method for signature 'missingOrNULL' installConda(session) ## S4 method for signature 'Session' installConda(session)
session |
|
Invisibly returns TRUE
upon success (i.e.successful
install) and FALSE
upon failure.
## Not run: # Install Conda for the default SyncroSim session installConda() ## End(Not run)
## Not run: # Install Conda for the default SyncroSim session installConda() ## End(Not run)
This function installs a package to the SyncroSim Session
.
If only the package name is provided as input, the function queries the
SyncroSim package server for the specified package. If a file path is
provided as input, the function installs a package to SyncroSim from a local
package file (ends in ".ssimpkg"). The list of SyncroSim packages can be
found here.
installPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,character' installPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,missingOrNULL' installPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,Session' installPackage(packages, versions = NULL, session = NULL)
installPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,character' installPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,missingOrNULL' installPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,Session' installPackage(packages, versions = NULL, session = NULL)
packages |
character string. The name or file path of the package to install |
versions |
character string. The packages version(s) to install if
installing a package from the server. If |
session |
|
Invisibly returns TRUE
upon success (i.e.successful
install) and FALSE
upon failure.
## Not run: # Create a new SyncroSim Session mySession <- session() # Install package from the package server installPackage(packages="stsim", versions="4.0.1", session = mySession) # Install package using a local file path installPackage("c:/path/to/stsim.ssimpkg") ## End(Not run)
## Not run: # Create a new SyncroSim Session mySession <- session() # Install package from the package server installPackage(packages="stsim", versions="4.0.1", session = mySession) # Install package using a local file path installPackage("c:/path/to/stsim.ssimpkg") ## End(Not run)
Retrieves or sets whether or not a Scenario
is configured to
merge dependencies at run time.
mergeDependencies(ssimObject) ## S4 method for signature 'character' mergeDependencies(ssimObject) ## S4 method for signature 'Scenario' mergeDependencies(ssimObject) mergeDependencies(ssimObject) <- value ## S4 replacement method for signature 'character' mergeDependencies(ssimObject) <- value ## S4 replacement method for signature 'Scenario' mergeDependencies(ssimObject) <- value
mergeDependencies(ssimObject) ## S4 method for signature 'character' mergeDependencies(ssimObject) ## S4 method for signature 'Scenario' mergeDependencies(ssimObject) mergeDependencies(ssimObject) <- value ## S4 replacement method for signature 'character' mergeDependencies(ssimObject) <- value ## S4 replacement method for signature 'Scenario' mergeDependencies(ssimObject) <- value
ssimObject |
|
value |
logical. If |
A logical: TRUE
if the scenario is configured to merge dependencies at run time,
and FALSE
otherwise.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Retrieve whether or not dependencies will be merged for a Scenario mergeDependencies(myScenario) # Set whether or not dependencies will be merged for a Scenario mergeDependencies(myScenario) <- TRUE ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Retrieve whether or not dependencies will be merged for a Scenario mergeDependencies(myScenario) # Set whether or not dependencies will be merged for a Scenario mergeDependencies(myScenario) <- TRUE ## End(Not run)
Retrieves or sets the name of a SsimLibrary
,
Project
, Scenario
, or Folder
.
name(ssimObject) ## S4 method for signature 'character' name(ssimObject) ## S4 method for signature 'SsimLibrary' name(ssimObject) ## S4 method for signature 'Scenario' name(ssimObject) ## S4 method for signature 'Project' name(ssimObject) ## S4 method for signature 'Folder' name(ssimObject) ## S4 method for signature 'Chart' name(ssimObject) name(ssimObject) <- value ## S4 replacement method for signature 'character' name(ssimObject) <- value ## S4 replacement method for signature 'SsimLibrary' name(ssimObject) <- value ## S4 replacement method for signature 'Project' name(ssimObject) <- value ## S4 replacement method for signature 'Scenario' name(ssimObject) <- value ## S4 replacement method for signature 'Folder' name(ssimObject) <- value ## S4 replacement method for signature 'Chart' name(ssimObject) <- value
name(ssimObject) ## S4 method for signature 'character' name(ssimObject) ## S4 method for signature 'SsimLibrary' name(ssimObject) ## S4 method for signature 'Scenario' name(ssimObject) ## S4 method for signature 'Project' name(ssimObject) ## S4 method for signature 'Folder' name(ssimObject) ## S4 method for signature 'Chart' name(ssimObject) name(ssimObject) <- value ## S4 replacement method for signature 'character' name(ssimObject) <- value ## S4 replacement method for signature 'SsimLibrary' name(ssimObject) <- value ## S4 replacement method for signature 'Project' name(ssimObject) <- value ## S4 replacement method for signature 'Scenario' name(ssimObject) <- value ## S4 replacement method for signature 'Folder' name(ssimObject) <- value ## S4 replacement method for signature 'Chart' name(ssimObject) <- value
ssimObject |
|
value |
character string of the new name |
A character string: the name of the SsimObject.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim") myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myFolder <- folder(myProject, folder = "New Folder") myChart <- chart(myProject, chart = "New Chart") # Retrieve names of the SsimObjects name(myLibrary) name(myProject) name(myScenario) name(myFolder) name(myChart) # Set the name of the SyncroSim Scenario name(myScenario) <- "My Scenario Name" ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "stsim") myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myFolder <- folder(myProject, folder = "New Folder") myChart <- chart(myProject, chart = "New Chart") # Retrieve names of the SsimObjects name(myLibrary) name(myProject) name(myScenario) name(myFolder) name(myChart) # Set the name of the SyncroSim Scenario name(myScenario) <- "My Scenario Name" ## End(Not run)
Retrieves or sets the owner of a SsimLibrary
,
Project
, or Scenario
.
owner(ssimObject) owner(ssimObject) <- value ## S4 method for signature 'character' owner(ssimObject) ## S4 method for signature 'SsimLibrary' owner(ssimObject) ## S4 method for signature 'Project' owner(ssimObject) ## S4 method for signature 'Scenario' owner(ssimObject) ## S4 replacement method for signature 'character' owner(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' owner(ssimObject) <- value
owner(ssimObject) owner(ssimObject) <- value ## S4 method for signature 'character' owner(ssimObject) ## S4 method for signature 'SsimLibrary' owner(ssimObject) ## S4 method for signature 'Project' owner(ssimObject) ## S4 method for signature 'Scenario' owner(ssimObject) ## S4 replacement method for signature 'character' owner(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' owner(ssimObject) <- value
ssimObject |
|
value |
character string of the new owner |
A character string: the owner of the SsimObject.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Retrieve the owner of an SsimObject owner(myLibrary) owner(myProject) owner(myScenario) # Set the owner of a SyncroSim Scenario owner(myScenario) <- "Apex RMS" ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Retrieve the owner of an SsimObject owner(myLibrary) owner(myProject) owner(myScenario) # Set the owner of a SyncroSim Scenario owner(myScenario) <- "Apex RMS" ## End(Not run)
Retrieves the packages installed or available in the current session if
called on a Session
object, or the packages added to a
SyncroSim Library if called on a SsimLibrary
object.
packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'character' packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'missingOrNULL' packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'Session' packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'SsimLibrary' packages(ssimObject)
packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'character' packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'missingOrNULL' packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'Session' packages(ssimObject = NULL, installed = TRUE) ## S4 method for signature 'SsimLibrary' packages(ssimObject)
ssimObject |
|
installed |
logical or character. |
Returns a data.frame
of packages installed or templates available
for a specified package.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # List all installed packages packages(mySession) # List all available packages on the server (including currently installed) packages(installed = FALSE) # Check the package(s) in your SsimLibrary packages(myLibrary) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # List all installed packages packages(mySession) # List all available packages on the server (including currently installed) packages(installed = FALSE) # Check the package(s) in your SsimLibrary packages(myLibrary) ## End(Not run)
Retrieves the id of the parent of a SyncroSim results Scenario or a SyncroSim Folder.
parentId(child) ## S4 method for signature 'character' parentId(child) ## S4 method for signature 'Scenario' parentId(child) ## S4 method for signature 'Folder' parentId(child)
parentId(child) ## S4 method for signature 'character' parentId(child) ## S4 method for signature 'Scenario' parentId(child) ## S4 method for signature 'Folder' parentId(child)
child |
An integer id of the parent Scenario if input is a Scenario, or an integer
id of the parent Folder if input is a Folder. If the input Scenario or Folder
does not have a parent, the function returns NA
## Not run: # Set the file path and name of an existing SsimLibrary myLibraryName <- "MyLibrary.ssim" # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario to generate results resultScenario <- run(myScenario) # Find the parent ID of the Scenario parentId(resultScenario) ## End(Not run)
## Not run: # Set the file path and name of an existing SsimLibrary myLibraryName <- "MyLibrary.ssim" # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario to generate results resultScenario <- run(myScenario) # Find the parent ID of the Scenario parentId(resultScenario) ## End(Not run)
Retrieves a printCmd setting of a Session
object. The printCmd
setting configures a Session for printing commands sent to the console.
printCmd(session = NULL) ## S4 method for signature 'Session' printCmd(session = NULL) ## S4 method for signature 'missingOrNULLOrChar' printCmd(session = NULL)
printCmd(session = NULL) ## S4 method for signature 'Session' printCmd(session = NULL) ## S4 method for signature 'missingOrNULLOrChar' printCmd(session = NULL)
session |
Session object or character. The Session or path
to a Session where the printCmd settings are retrieved from. If |
A logical : TRUE
if the session is configured to print commands and
FALSE
if it is not.
## Not run: # Set SyncroSim Session mySession <- session() # Retrieve printCmd settings for given Session printCmd(mySession) ## End(Not run)
## Not run: # Set SyncroSim Session mySession <- session() # Retrieve printCmd settings for given Session printCmd(mySession) ## End(Not run)
This function is designed to facilitate the development of R-based Syncrosim Packages, such as beginning, stepping, ending, and reporting the progress for a SyncroSim simulation.
progressBar( type = "step", iteration = NULL, timestep = NULL, totalSteps = NULL, message )
progressBar( type = "step", iteration = NULL, timestep = NULL, totalSteps = NULL, message )
type |
character. Update to apply to progress bar. Options include "begin", "end", "step", "report", and "message" (Default is "step") |
iteration |
integer. The current iteration. Only used if
|
timestep |
integer. The current timestep. Only used if
|
totalSteps |
integer. The total number of steps in the simulation. Only
used if |
message |
character. An arbitrary messsage to be printed to the status
bar. Only used if |
No returned value, used for side effects
## Not run: # Begin the progress bar for a simulation progressBar(type = "begin", totalSteps = numIterations * numTimesteps) # Increase the progress bar by one step for a simulation progressBar(type = "step") # Report progress for a simulation progressBar(type = "report", iteration = iter, timestep = ts) # Report arbitrary progress message progressBar(type = "message", message = msg) # End the progress bar for a simulation progressBar(type = "end") ## End(Not run)
## Not run: # Begin the progress bar for a simulation progressBar(type = "begin", totalSteps = numIterations * numTimesteps) # Increase the progress bar by one step for a simulation progressBar(type = "step") # Report progress for a simulation progressBar(type = "report", iteration = iter, timestep = ts) # Report arbitrary progress message progressBar(type = "message", message = msg) # End the progress bar for a simulation progressBar(type = "end") ## End(Not run)
Creates or retrieves a Project
or multiple Projects from a
SsimLibrary.
project( ssimObject = NULL, project = NULL, sourceProject = NULL, summary = NULL, forceElements = FALSE, overwrite = FALSE )
project( ssimObject = NULL, project = NULL, sourceProject = NULL, summary = NULL, forceElements = FALSE, overwrite = FALSE )
ssimObject |
|
project |
|
sourceProject |
|
summary |
logical. If |
forceElements |
logical. If |
overwrite |
logical. If |
For each element of project:
If element identifies an existing Project: Returns the existing Project.
If element identifies more than one Project: Error.
If element does not identify an existing Project: Creates a new Project named element. Note that SyncroSim automatically assigns an id to a new Project.
Returns a Project
object representing a SyncroSim Project. If
summary is TRUE
, returns a data.frame of Project names and descriptions.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib_project") # Set the SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(ssimObject = myLibrary, project = "My project name") myproject2 <- project(ssimObject = myLibrary, project = "My new project name") # Get a named list of existing Projects # Each element in the list is named by a character version of the Project ID myProjects <- project(myLibrary, summary = FALSE) names(myProjects) # Get an existing Project. myProject <- myProjects[[1]] myProject <- project(myLibrary, project = "My new project name") # Get/set the Project properties name(myProject) name(myProject) <- "New project name" # Create a new Project from a copy of an existing Project myNewProject <- project(myLibrary, project = "My copied project", sourceProject = 1) # Overwrite an existing Project myNewProject <- project(myLibrary, project = "My copied project", overwrite = TRUE) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib_project") # Set the SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(ssimObject = myLibrary, project = "My project name") myproject2 <- project(ssimObject = myLibrary, project = "My new project name") # Get a named list of existing Projects # Each element in the list is named by a character version of the Project ID myProjects <- project(myLibrary, summary = FALSE) names(myProjects) # Get an existing Project. myProject <- myProjects[[1]] myProject <- project(myLibrary, project = "My new project name") # Get/set the Project properties name(myProject) name(myProject) <- "New project name" # Create a new Project from a copy of an existing Project myNewProject <- project(myLibrary, project = "My copied project", sourceProject = 1) # Overwrite an existing Project myNewProject <- project(myLibrary, project = "My copied project", overwrite = TRUE) ## End(Not run)
Project
object representing a SyncroSim Project. A Project is the intermediate
level of organization in the SyncroSim workflow, between the ssimLibrary
and the scenario
. It contains information relevant to a group
of Scenarios.
session
Session
object. The Session associated with the
Project's SsimLibrary
filepath
character string. The path to the Project's SsimLibrary on disk
datasheetNames
Names and scopes of datasheets in the Project's Library
projectId
integer. The Project id
See project
for options when creating or loading a
SyncroSim Project.
Retrieves the projectId of a SyncroSim Project
,
Scenario
, Folder
or Chart
.
projectId(ssimObject) ## S4 method for signature 'character' projectId(ssimObject) ## S4 method for signature 'Project' projectId(ssimObject) ## S4 method for signature 'Scenario' projectId(ssimObject) ## S4 method for signature 'Folder' projectId(ssimObject) ## S4 method for signature 'Chart' projectId(ssimObject)
projectId(ssimObject) ## S4 method for signature 'character' projectId(ssimObject) ## S4 method for signature 'Project' projectId(ssimObject) ## S4 method for signature 'Scenario' projectId(ssimObject) ## S4 method for signature 'Folder' projectId(ssimObject) ## S4 method for signature 'Chart' projectId(ssimObject)
ssimObject |
An integer: project id.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Get Project ID for SyncroSim Project and Scenario projectId(myProject) projectId(myScenario) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Get Project ID for SyncroSim Project and Scenario projectId(myProject) projectId(myScenario) ## End(Not run)
Retrieves or sets whether or not a SsimLibrary
,
Project
, Scenario
, or Folder
is
read-only.
readOnly(ssimObject) ## S4 method for signature 'character' readOnly(ssimObject) ## S4 method for signature 'SsimLibrary' readOnly(ssimObject) ## S4 method for signature 'Project' readOnly(ssimObject) ## S4 method for signature 'Scenario' readOnly(ssimObject) ## S4 method for signature 'Folder' readOnly(ssimObject) ## S4 method for signature 'Chart' readOnly(ssimObject) readOnly(ssimObject) <- value ## S4 replacement method for signature 'character' readOnly(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' readOnly(ssimObject) <- value ## S4 replacement method for signature 'Folder' readOnly(ssimObject) <- value ## S4 replacement method for signature 'Chart' readOnly(ssimObject) <- value
readOnly(ssimObject) ## S4 method for signature 'character' readOnly(ssimObject) ## S4 method for signature 'SsimLibrary' readOnly(ssimObject) ## S4 method for signature 'Project' readOnly(ssimObject) ## S4 method for signature 'Scenario' readOnly(ssimObject) ## S4 method for signature 'Folder' readOnly(ssimObject) ## S4 method for signature 'Chart' readOnly(ssimObject) readOnly(ssimObject) <- value ## S4 replacement method for signature 'character' readOnly(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' readOnly(ssimObject) <- value ## S4 replacement method for signature 'Folder' readOnly(ssimObject) <- value ## S4 replacement method for signature 'Chart' readOnly(ssimObject) <- value
ssimObject |
|
value |
logical. If |
A logical: TRUE
if the SsimObject is read-only and FALSE
otherwise.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, Scenario, and Folder mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myFolder <- folder(myProject, "My Folder") # Retrieve the read-only status of a SsimObject readOnly(myLibrary) readOnly(myProject) readOnly(myScenario) readOnly(myFolder) # Set the read-only status of a SsimObject readOnly(myScenario) <- TRUE ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, Project, Scenario, and Folder mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myFolder <- folder(myProject, "My Folder") # Retrieve the read-only status of a SsimObject readOnly(myLibrary) readOnly(myProject) readOnly(myScenario) readOnly(myFolder) # Set the read-only status of a SsimObject readOnly(myScenario) <- TRUE ## End(Not run)
Removes package(s) from a SsimLibrary
.
removePackage(ssimLibrary, packages) ## S4 method for signature 'character' removePackage(ssimLibrary, packages) ## S4 method for signature 'SsimLibrary' removePackage(ssimLibrary, packages)
removePackage(ssimLibrary, packages) ## S4 method for signature 'character' removePackage(ssimLibrary, packages) ## S4 method for signature 'SsimLibrary' removePackage(ssimLibrary, packages)
ssimLibrary |
|
packages |
character string or vector of package name(s) |
This function invisibly returns TRUE
upon success (i.e.successful
removal of the package) or FALSE
upon failure.
## Not run: # Install "stsim" and "stsimecodep" SyncroSim packages installPackage("stsim") installPackage("stsimecodep") # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Add package addPackage(myLibrary, packages = "stsim", versions = "4.0.1") addPackage(myLibrary, packages = "stsimecodep") packages(myLibrary) # Remove package removePackage(myLibrary, packages = c("stsim", "stsimecodep")) packages(myLibrary) ## End(Not run)
## Not run: # Install "stsim" and "stsimecodep" SyncroSim packages installPackage("stsim") installPackage("stsimecodep") # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Add package addPackage(myLibrary, packages = "stsim", versions = "4.0.1") addPackage(myLibrary, packages = "stsimecodep") packages(myLibrary) # Remove package removePackage(myLibrary, packages = c("stsim", "stsimecodep")) packages(myLibrary) ## End(Not run)
rsyncrosim provides an interface to SyncroSim, a generalized framework for running and managing scenario-based stochastic simulations over space and time. Different kinds of simulation models can "plug-in" to SyncroSim as packages and take advantage of general features common to many kinds of simulation models, such as defining scenarios of inputs, running Monte Carlo simulations, and viewing charts and maps of outputs.
To learn more about rsyncrosim, start with the vignette tutorial:
browseVignettes("rsyncrosim")
.
Maintainer: Katie Birchard [email protected]
Authors:
Colin Daniel [email protected]
Josie Hughes [email protected]
Valentin Lucet
Alex Embrey
Leonardo Frid
Tabitha Kennedy
Shreeram Senthivasan
Other contributors:
ApexRMS [copyright holder]
Useful links:
Report bugs at https://github.com/syncrosim/rsyncrosim/issues/
Run one or more SyncroSim Scenario
(s).
run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL ) ## S4 method for signature 'character' run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL ) ## S4 method for signature 'list' run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL ) ## S4 method for signature 'SsimObject' run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL )
run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL ) ## S4 method for signature 'character' run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL ) ## S4 method for signature 'list' run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL ) ## S4 method for signature 'SsimObject' run( ssimObject, scenario = NULL, summary = FALSE, copyExternalInputs = FALSE, transformerName = NULL )
ssimObject |
|
scenario |
character, integer, or vector of these. Scenario names or ids.
If |
summary |
logical. If |
copyExternalInputs |
logical. If |
transformerName |
character. The name of the transformer to run (optional) |
Note that breakpoints are ignored unless the SsimObject is a single Scenario.
If summary = FALSE
, returns a result Scenario object or a named list
of result Scenarios. The name is the parent Scenario for each result. If
summary = TRUE
, returns summary info for result Scenarios.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- "testlib" # Set the SyncroSim Session, SsimLibrary, Project, and Scenario myLibrary <- ssimLibrary(name = myLibraryName, packages = "helloworldSpatial") myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myScenario2 <- scenario(myProject, scenario = "My Scenario 2") # Run with default parameters resultScenario <- run(myScenario) # Only return summary information resultScenarioSummary <- run(myScenario, summary = TRUE) # Run 2 scenarios at once resultScenarios <- run(c(myScenario, myScenario2)) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- "testlib" # Set the SyncroSim Session, SsimLibrary, Project, and Scenario myLibrary <- ssimLibrary(name = myLibraryName, packages = "helloworldSpatial") myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") myScenario2 <- scenario(myProject, scenario = "My Scenario 2") # Run with default parameters resultScenario <- run(myScenario) # Only return summary information resultScenarioSummary <- run(myScenario, summary = TRUE) # Run 2 scenarios at once resultScenarios <- run(c(myScenario, myScenario2)) ## End(Not run)
Retrieves the run log of a result Scenario.
runLog(scenario) ## S4 method for signature 'character' runLog(scenario) ## S4 method for signature 'Scenario' runLog(scenario)
runLog(scenario) ## S4 method for signature 'character' runLog(scenario) ## S4 method for signature 'Scenario' runLog(scenario)
scenario |
|
A character string: the run log for a result scenario.
## Not run: # Set the file path and name of an existing SsimLibrary myLibraryName <- file.path("MyLibrary.ssim") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario resultScenario <- run(myScenario) # Retrieve the run log of the result Scenario runLog(resultScenario) ## End(Not run)
## Not run: # Set the file path and name of an existing SsimLibrary myLibraryName <- file.path("MyLibrary.ssim") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario resultScenario <- run(myScenario) # Retrieve the run log of the result Scenario runLog(resultScenario) ## End(Not run)
This function is part of a set of functions designed to facilitate the development of R-based Syncrosim Packages. This function creates and returns a SyncroSim Data Folder.
runtimeDataFolder(scenario, datasheetName)
runtimeDataFolder(scenario, datasheetName)
scenario |
|
datasheetName |
character. The datasheet name |
Returns a data folder name for the specified datasheet.
## Not run: dataFolder <- runtimeDataFolder() ## End(Not run)
## Not run: dataFolder <- runtimeDataFolder() ## End(Not run)
This function is part of a set of functions designed to facilitate the development of R-based Syncrosim Packages. This function creates and returns a SyncroSim Temporary Folder.
runtimeTempFolder(folderName)
runtimeTempFolder(folderName)
folderName |
character. The folder name |
Returns a temporary folder name.
## Not run: tempFolder <- runtimeTempFolder() ## End(Not run)
## Not run: tempFolder <- runtimeTempFolder() ## End(Not run)
Saves Datasheets to a SsimLibrary
, Project
, or
Scenario
.
saveDatasheet( ssimObject, data, name = NULL, fileData = NULL, append = NULL, forceElements = FALSE, force = FALSE, breakpoint = FALSE, import = TRUE, path = NULL ) ## S4 method for signature 'character' saveDatasheet( ssimObject, data, name = NULL, fileData = NULL, append = NULL, forceElements = FALSE, force = FALSE, breakpoint = FALSE, import = TRUE, path = NULL ) ## S4 method for signature 'SsimObject' saveDatasheet( ssimObject, data, name = NULL, fileData = NULL, append = NULL, forceElements = FALSE, force = FALSE, breakpoint = FALSE, import = TRUE, path = NULL )
saveDatasheet( ssimObject, data, name = NULL, fileData = NULL, append = NULL, forceElements = FALSE, force = FALSE, breakpoint = FALSE, import = TRUE, path = NULL ) ## S4 method for signature 'character' saveDatasheet( ssimObject, data, name = NULL, fileData = NULL, append = NULL, forceElements = FALSE, force = FALSE, breakpoint = FALSE, import = TRUE, path = NULL ) ## S4 method for signature 'SsimObject' saveDatasheet( ssimObject, data, name = NULL, fileData = NULL, append = NULL, forceElements = FALSE, force = FALSE, breakpoint = FALSE, import = TRUE, path = NULL )
ssimObject |
|
data |
data.frame, named vector, or list of these. One or more Datasheets to load |
name |
character or vector of these. The name(s) of the Datasheet(s) to
be saved. If a vector of names is provided, then a list must be provided
for the |
fileData |
named list or SpatRaster object. Names are file names (without paths),
corresponding to entries in |
append |
logical. If |
forceElements |
logical. If |
force |
logical. If Datasheet scope is Project/SsimLibrary, and |
breakpoint |
logical. Set to |
import |
logical. Set to |
path |
character. output path (optional) |
SsimObject/Project/Scenario should identify a single SsimObject.
If fileData != NULL
, each element of names(fileData)
should correspond uniquely
to at most one entry in data. If a name is not found in data the element will
be ignored with a warning. If names(fileData)
are full filepaths, rsyncrosim
will write each object to the corresponding path for subsequent loading by SyncroSim.
Note this is generally more time-consuming because the files must be written twice.
If names(fileData)
are not filepaths (faster, recommended), rsyncrosim will
write each element directly to the appropriate SyncroSim input/output folders.
rsyncrosim will write each element of fileData directly to the appropriate
SyncroSim input/output folders. If fileData != NULL
, data should be a data.frame,
vector, or list of length 1, not a list of length >1.
About the 'append' argument:
A Datasheet is a VALIDATION SOURCE if its data can be used to validate column values in a different Datasheet.
The append
argument will be ignored if the Datasheet is a validation
source and has a Project scope. In this case the data will be MERGED.
Invisibly returns a vector or list of logical values for each
input: TRUE
upon success (i.e.successful save) and FALSE
upon failure.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "helloworldSpatial") myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Get all Datasheet info myDatasheets <- datasheet(myScenario) # Get a specific Datasheet myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_RunControl") # Modify Datasheet myDatasheet$MaximumTimestep <- 10 # Save Datasheet saveDatasheet(ssimObject = myScenario, data = myDatasheet, name = "helloworldSpatial_RunControl") # Import data after saving saveDatasheet(ssimObject = myScenario, data = myDatasheet, name = "helloworldSpatial_RunControl", import = TRUE) # Save the new Datasheet to a specified output path saveDatasheet(ssimObject = myScenario, data = myDatasheet, name = "helloworldSpatial_RunControl", path = tempdir()) # Save a raster stack using fileData # Create a raster stack - add as many raster files as you want here map1 <- datasheetSpatRaster(myScenario, datasheet = "helloworldSpatial_InputDatasheet", column = "InterceptRasterFile") inRasters <- terra::rast(map1) # Change the name of the rasters in the input Datasheets to match the stack inSheet <- datasheet(myScenario, name = "helloworldSpatial_InputDatasheet") inSheet[1,"InterceptRasterFile"] <- names(inRasters)[1] # Save the raster stack to the input Datasheet saveDatasheet(myScenario, data = inSheet, name = "helloworldSpatial_InputDatasheet", fileData = inRasters) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession, packages = "helloworldSpatial") myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Get all Datasheet info myDatasheets <- datasheet(myScenario) # Get a specific Datasheet myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_RunControl") # Modify Datasheet myDatasheet$MaximumTimestep <- 10 # Save Datasheet saveDatasheet(ssimObject = myScenario, data = myDatasheet, name = "helloworldSpatial_RunControl") # Import data after saving saveDatasheet(ssimObject = myScenario, data = myDatasheet, name = "helloworldSpatial_RunControl", import = TRUE) # Save the new Datasheet to a specified output path saveDatasheet(ssimObject = myScenario, data = myDatasheet, name = "helloworldSpatial_RunControl", path = tempdir()) # Save a raster stack using fileData # Create a raster stack - add as many raster files as you want here map1 <- datasheetSpatRaster(myScenario, datasheet = "helloworldSpatial_InputDatasheet", column = "InterceptRasterFile") inRasters <- terra::rast(map1) # Change the name of the rasters in the input Datasheets to match the stack inSheet <- datasheet(myScenario, name = "helloworldSpatial_InputDatasheet") inSheet[1,"InterceptRasterFile"] <- names(inRasters)[1] # Save the raster stack to the input Datasheet saveDatasheet(myScenario, data = inSheet, name = "helloworldSpatial_InputDatasheet", fileData = inRasters) ## End(Not run)
Create or open one or more Scenario
s from a
SsimLibrary
.
scenario( ssimObject = NULL, scenario = NULL, sourceScenario = NULL, folder = NULL, summary = NULL, results = FALSE, forceElements = FALSE, overwrite = FALSE )
scenario( ssimObject = NULL, scenario = NULL, sourceScenario = NULL, folder = NULL, summary = NULL, results = FALSE, forceElements = FALSE, overwrite = FALSE )
ssimObject |
|
scenario |
character, integer, or vector of these. Names or ids of one or more Scenarios. Note integer ids are slightly faster, but can only be used to open existing Scenarios |
sourceScenario |
character or integer. If not |
folder |
|
summary |
logical. If |
results |
logical. If |
forceElements |
logical. If |
overwrite |
logical. If |
For each element of Scenario:
If element/Project/SsimObject uniquely identifies an existing Scenario: Returns the existing Scenario.
If element/Project/SsimObject uniquely identifies more than one existing Scenario: Error.
If element/Project/SsimObject do not identify an existing Scenario or Project: Error.
If element/Project/SsimObject do not identify an existing Scenario and element is numeric: Error - a name is required for new Scenarios. SyncroSim will automatically assign an id when a Scenario is created.
If element/Project/SsimObject do not identify an existing Scenario and
do identify a Project, and element is a character string: Creates a
new Scenario named element in the Project. SyncroSim automatically
assigns an id. If sourceScenario is not NULL
the new Scenario will be
a copy of sourceScenario.
A Scenario
object representing a SyncroSim scenario, a list of Scenario
objects, or a data frame of Scenario names and descriptions. If summary = FALSE
,
returns one or more Scenario
objects representing SyncroSim Scenarios.
If summary = TRUE
, returns Scenario summary info.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "My Project") # Create a new Scenario myScenario <- scenario(myProject, scenario = "My Scenario") # Create a new Scenario from an existing Scenario myScenarioCopy <- scenario(myProject, scenario = "My Scenario Copy", sourceScenario = myScenario) # Find all the Scenarios in a SsimLibrary scenario(myLibrary) # Only return the results Scenarios for a SsimLibrary scenario(myLibrary, results = TRUE) # Overwrite an existing Scenario myNewScenario <- scenario(myProject, scenario = "My New Scenario", overwrite = TRUE) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "My Project") # Create a new Scenario myScenario <- scenario(myProject, scenario = "My Scenario") # Create a new Scenario from an existing Scenario myScenarioCopy <- scenario(myProject, scenario = "My Scenario Copy", sourceScenario = myScenario) # Find all the Scenarios in a SsimLibrary scenario(myLibrary) # Only return the results Scenarios for a SsimLibrary scenario(myLibrary, results = TRUE) # Overwrite an existing Scenario myNewScenario <- scenario(myProject, scenario = "My New Scenario", overwrite = TRUE) ## End(Not run)
Scenario
object representing a SyncroSim Scenario. A Scenario is the
lowest level of organization in the SyncroSim workflow, and is often used
to isolate information on a single Datasheet.
session
Session
object. The Session associated with the
Scenario
filepath
character string. The path to the Scenario's SsimLibrary on disk
datasheetNames
character string. Names and scope of all Datasheets in Scenario's SsimLibrary
projectId
integer. The Project id
scenarioId
integer. The Scenario id
parentId
integer. For a result Scenario, this is the id of the parent Scenario. 0 indicates this is not a result Scenario
folderId
integer. The folder in which the Scenario exists. If the Scenario exists at the root of the project, then this value is NULL.
See scenario
for options when creating or loading a
SyncroSim Scenario.
Retrieves the scenarioId of a Scenario
.
scenarioId(scenario) ## S4 method for signature 'character' scenarioId(scenario) ## S4 method for signature 'Scenario' scenarioId(scenario)
scenarioId(scenario) ## S4 method for signature 'character' scenarioId(scenario) ## S4 method for signature 'Scenario' scenarioId(scenario)
scenario |
|
Integer id of the input Scenario.
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Get Scenario ID of Scenario scenarioId(myScenario) ## End(Not run)
## Not run: # Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Get Scenario ID of Scenario scenarioId(myScenario) ## End(Not run)
Methods to create or return a SyncroSim Session
.
session(x = NULL, silent = TRUE, printCmd = FALSE) ## S4 method for signature 'missingOrNULLOrChar' session(x = NULL, silent = TRUE, printCmd = FALSE) ## S4 method for signature 'SsimObject' session(x = NULL, silent = TRUE, printCmd = FALSE) ## S4 method for signature 'Folder' session(x = NULL, silent = TRUE, printCmd = FALSE) session(ssimObject) <- value ## S4 replacement method for signature 'NULLOrChar' session(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' session(ssimObject) <- value
session(x = NULL, silent = TRUE, printCmd = FALSE) ## S4 method for signature 'missingOrNULLOrChar' session(x = NULL, silent = TRUE, printCmd = FALSE) ## S4 method for signature 'SsimObject' session(x = NULL, silent = TRUE, printCmd = FALSE) ## S4 method for signature 'Folder' session(x = NULL, silent = TRUE, printCmd = FALSE) session(ssimObject) <- value ## S4 replacement method for signature 'NULLOrChar' session(ssimObject) <- value ## S4 replacement method for signature 'SsimObject' session(ssimObject) <- value
x |
character or SsimObject. Path to SyncroSim installation. If |
silent |
logical. Applies only if x is a path or |
printCmd |
logical. Applies only if x is a path or |
ssimObject |
|
value |
|
In order to avoid problems with SyncroSim version compatibility and SsimLibrary
updating, the new Session must have the same filepath as the Session of the
SsimObject
e.g. filepath(value)==filepath(session(ssimObject))
.
Therefore, the only time when you will need to set a new SyncroSim Session is if you
have updated the SyncroSim software and want to update an existing SsimObject
to use the new software.
A SyncroSim Session
object.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") # Lists the folder location of SyncroSim Session filepath(mySession) # Lists the version of SyncroSim Session version(mySession) # Data frame of the packages installed with this version of SyncroSim packages(mySession) # Set a new SyncroSim Session for the SyncroSim Project session(myProject) <- session(x = filepath(session(myProject))) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session, SsimLibrary, and Project mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") # Lists the folder location of SyncroSim Session filepath(mySession) # Lists the version of SyncroSim Session version(mySession) # Data frame of the packages installed with this version of SyncroSim packages(mySession) # Set a new SyncroSim Session for the SyncroSim Project session(myProject) <- session(x = filepath(session(myProject))) ## End(Not run)
A SyncroSim Session object contains a link to a SyncroSim installation.
SsimLibrary
, Project
and Scenario
objects contain a
Session
used to query and modify the object.
filepath
The path to the SyncroSim installation
silent
If FALSE
, all SyncroSim output with non-zero exit status is
printed. Helpful for debugging. Default is TRUE
printCmd
If TRUE
, arguments passed to the SyncroSim console are also
printed. Helpful for debugging. Default is FALSE
condaFilepath
The path to the Conda installation. Default is "default"
See session
for options when creating a Session.
Checks or sets whether a SyncroSim Session
is silent or not. In
a silent session, warnings from the console are ignored.
silent(session) ## S4 method for signature 'Session' silent(session) ## S4 method for signature 'missingOrNULLOrChar' silent(session) silent(session) <- value ## S4 replacement method for signature 'character' silent(session) <- value ## S4 replacement method for signature 'Session' silent(session) <- value
silent(session) ## S4 method for signature 'Session' silent(session) ## S4 method for signature 'missingOrNULLOrChar' silent(session) silent(session) <- value ## S4 replacement method for signature 'character' silent(session) <- value ## S4 replacement method for signature 'Session' silent(session) <- value
session |
|
value |
logical. If |
A logical: TRUE
if the session is silent and FALSE
otherwise.
## Not run: # Set up a SyncroSim Session mySession <- session() # Check the silent status of a SyncroSim Session silent(mySession) # Set the silent status of a SyncroSim Session silent(mySession) <- FALSE ## End(Not run)
## Not run: # Set up a SyncroSim Session mySession <- session() # Check the silent status of a SyncroSim Session silent(mySession) # Set the silent status of a SyncroSim Session silent(mySession) <- FALSE ## End(Not run)
Creates SELECT
, GROUP BY
and WHERE
SQL statements.
The resulting list of SQL statements will be converted to an SQLite database
query by the datasheet
function.
sqlStatement( groupBy = NULL, aggregate = NULL, aggregateFunction = "SUM", where = NULL )
sqlStatement( groupBy = NULL, aggregate = NULL, aggregateFunction = "SUM", where = NULL )
groupBy |
character string or vector of these. Vector of variables
(column names) to |
aggregate |
character string of vector of these. Vector of variables
(column names) to aggregate using |
aggregateFunction |
character string. An SQL aggregate function
(e.g. |
where |
named list. A list of subset variables. Names are column names, and elements are the values to be selected from each column (optional) |
Variables are column names of the Datasheet. See column names using datasheet(,empty=TRUE)
Variables not included in groupBy
, aggregate
or where
will be dropped from the table.
Note that it is not possible to construct a complete SQL query at this stage,
because the datasheet
function may add ScenarioId and/or ProjectId to the query.
Returns a list of SELECT
, GROUP BY
and WHERE
SQL statements used by the
datasheet
function to construct an SQLite database query.
## Not run: # Query total Amount for each combination of ScenarioId, Iteration, Timestep and StateLabelXID, # including only Timesteps 0,1 and 2, and Iterations 3 and 4. mySQL <- sqlStatement( groupBy = c("ScenarioId", "Iteration", "Timestep"), aggregate = c("yCum"), aggregateFunction = "SUM", where = list(Timestep = c(0, 1, 2), Iteration = c(3, 4)) ) mySQL ## End(Not run) ## Not run: # The SQL statement can then be used in the datasheet function # Set the file path and name of an existing SsimLibrary myLibraryName <- file.path("MyLibrary.ssim") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario to generate results resultScenario <- run(myScenario) # Use the SQL statement when loading the Datasheet myAggregatedDataFrame <- datasheet(resultScenario, name = "helloworldSpatial_OutputDatasheet", sqlStatement = mySQL) # View aggregated DataFrame myAggregatedDataFrame ## End(Not run)
## Not run: # Query total Amount for each combination of ScenarioId, Iteration, Timestep and StateLabelXID, # including only Timesteps 0,1 and 2, and Iterations 3 and 4. mySQL <- sqlStatement( groupBy = c("ScenarioId", "Iteration", "Timestep"), aggregate = c("yCum"), aggregateFunction = "SUM", where = list(Timestep = c(0, 1, 2), Iteration = c(3, 4)) ) mySQL ## End(Not run) ## Not run: # The SQL statement can then be used in the datasheet function # Set the file path and name of an existing SsimLibrary myLibraryName <- file.path("MyLibrary.ssim") # Set the SyncroSim Session, SsimLibrary, Project, and Scenario mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) myProject <- project(myLibrary, project = "Definitions") myScenario <- scenario(myProject, scenario = "My Scenario") # Run Scenario to generate results resultScenario <- run(myScenario) # Use the SQL statement when loading the Datasheet myAggregatedDataFrame <- datasheet(resultScenario, name = "helloworldSpatial_OutputDatasheet", sqlStatement = mySQL) # View aggregated DataFrame myAggregatedDataFrame ## End(Not run)
This function is part of a set of functions designed to facilitate the
development of R-based Syncrosim Packages. ssimEnvironment
retrieves
specific environment variables.
ssimEnvironment()
ssimEnvironment()
Returns a single-row data.frame of SyncroSim specific environment variables.
## Not run: # Get the whole set of variables e <- ssimEnvironment() # Get the path to transfer directory, for instance transferdir <- e$TransferDirectory ## End(Not run)
## Not run: # Get the whole set of variables e <- ssimEnvironment() # Get the path to transfer directory, for instance transferdir <- e$TransferDirectory ## End(Not run)
Creates or opens a SsimLibrary
object.
If summary = TRUE
, returns SsimLibrary summary info.
If summary = NULL
, returns SsimLibrary summary info if ssimObject is a SsimLibrary,
SsimLibrary object otherwise.
ssimLibrary( name = NULL, summary = NULL, packages = NULL, session = NULL, forceUpdate = FALSE, overwrite = FALSE, useConda = NULL ) ## S4 method for signature 'SsimObject' ssimLibrary( name = NULL, summary = NULL, packages = NULL, session = NULL, forceUpdate = FALSE, overwrite = FALSE, useConda = NULL ) ## S4 method for signature 'missingOrNULLOrChar' ssimLibrary( name = NULL, summary = NULL, packages = NULL, session = NULL, forceUpdate = FALSE, overwrite = FALSE, useConda = NULL )
ssimLibrary( name = NULL, summary = NULL, packages = NULL, session = NULL, forceUpdate = FALSE, overwrite = FALSE, useConda = NULL ) ## S4 method for signature 'SsimObject' ssimLibrary( name = NULL, summary = NULL, packages = NULL, session = NULL, forceUpdate = FALSE, overwrite = FALSE, useConda = NULL ) ## S4 method for signature 'missingOrNULLOrChar' ssimLibrary( name = NULL, summary = NULL, packages = NULL, session = NULL, forceUpdate = FALSE, overwrite = FALSE, useConda = NULL )
name |
|
summary |
logical. Default is |
packages |
character or character vector. The SyncroSim Package(s) to add to the Library if creating a new Library (optional) |
session |
|
forceUpdate |
logical. If |
overwrite |
logical. If |
useConda |
logical. If set to TRUE, then all packages associated with the Library will have their Conda environments created and Conda environments will be used during runtime.If set to FALSE, then no packages will have their Conda environments created and Conda environments will not be used during runtime. Default is NULL |
Example arguments:
If name is SyncroSim Project or Scenario: Returns the
SsimLibrary
associated with the Project or Scenario.
If name is NULL
: Create/open a SsimLibrary in the current working
directory with the filename SsimLibrary.ssim.
If name is a string: If string is not a valid path treat as filename in working directory. If no file suffix provided in string then add .ssim. Attempts to open a SsimLibrary of that name. If SsimLibrary does not exist creates a SsimLibrary of type package in the current working directory.
If given a name and a package: Create/open a SsimLibrary called name.ssim. Returns an error if the SsimLibrary already exists but is a different type of package.
Returns a SsimLibrary
object.
## Not run: # Make sure packages are installed installPackage("stsim") # Create or open a SsimLibrary using the default Session myLibrary <- ssimLibrary(name = file.path(tempdir(), "mylib")) # Create SsimLibrary using a specific Session mySession <- session() myLibrary <- ssimLibrary(name = file.path(tempdir(), "mylib"), session = mySession) # Retrieve SsimLibrary properties session(myLibrary) # Create SsimLibrary from template installPackage("helloworldSpatial") mySession <- session() myLibrary <- ssimLibrary(name = file.path(tempdir(), "mylib"), session = mySession, forceUpdate = TRUE, packages = "helloworldSpatial", overwrite = TRUE) ## End(Not run)
## Not run: # Make sure packages are installed installPackage("stsim") # Create or open a SsimLibrary using the default Session myLibrary <- ssimLibrary(name = file.path(tempdir(), "mylib")) # Create SsimLibrary using a specific Session mySession <- session() myLibrary <- ssimLibrary(name = file.path(tempdir(), "mylib"), session = mySession) # Retrieve SsimLibrary properties session(myLibrary) # Create SsimLibrary from template installPackage("helloworldSpatial") mySession <- session() myLibrary <- ssimLibrary(name = file.path(tempdir(), "mylib"), session = mySession, forceUpdate = TRUE, packages = "helloworldSpatial", overwrite = TRUE) ## End(Not run)
SsimLibrary
object representing a SyncroSim Library. A SsimLibrary is the
highest level of organization in the SyncroSim workflow and contains at
least one Project
.
session
Session
object
filepath
character string. The path to the SsimLibrary on disk
datasheetNames
character string. The name and scope of all Datasheets in the SsimLibrary.
See ssimLibrary
for options when creating or loading a
SyncroSim SsimLibrary.
Retrieves the temporary file path to a SyncroSim Session
,
SsimLibrary
, Project
or Scenario
on disk.
tempfilepath(ssimObject) ## S4 method for signature 'character' tempfilepath(ssimObject) ## S4 method for signature 'Session' tempfilepath(ssimObject) ## S4 method for signature 'SsimObject' tempfilepath(ssimObject)
tempfilepath(ssimObject) ## S4 method for signature 'character' tempfilepath(ssimObject) ## S4 method for signature 'Session' tempfilepath(ssimObject) ## S4 method for signature 'SsimObject' tempfilepath(ssimObject)
ssimObject |
|
A character string: the temporary file path to a SyncroSim object on disk.
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Get the temporary file path myFilePath <- tempfilepath(myLibrary) ## End(Not run)
## Not run: # Specify file path and name of new SsimLibrary myLibraryName <- file.path(tempdir(), "testlib") # Set up a SyncroSim Session and SsimLibrary mySession <- session() myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) # Get the temporary file path myFilePath <- tempfilepath(myLibrary) ## End(Not run)
Removes a package from SyncroSim installation
uninstallPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,character' uninstallPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,missingOrNULL' uninstallPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,Session' uninstallPackage(packages, versions = NULL, session = NULL)
uninstallPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,character' uninstallPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,missingOrNULL' uninstallPackage(packages, versions = NULL, session = NULL) ## S4 method for signature 'ANY,ANY,Session' uninstallPackage(packages, versions = NULL, session = NULL)
packages |
character or character vector. The name(s) of the package(s) to uninstall |
versions |
character or character vector. The version(s) of the
package(s) to uninstall. If |
session |
|
Invisibly returns TRUE
upon success (i.e.successful
removal) and FALSE
upon failure.
## Not run: # Set SyncroSim session mySession <- session() # Install packages to SyncroSim session installPackages(packages = c("stsim", "stsim"), versions = c("4.0.0", "4.0.1")) # Uninstalls specific version of package from SyncroSim session uninstallPackage(packages = "stsim", versions = "4.0.0", session = mySession) # Uninstalls all instances ofa package from SyncroSim session uninstallPackage(packages = "stsim", session = mySession) ## End(Not run)
## Not run: # Set SyncroSim session mySession <- session() # Install packages to SyncroSim session installPackages(packages = c("stsim", "stsim"), versions = c("4.0.0", "4.0.1")) # Uninstalls specific version of package from SyncroSim session uninstallPackage(packages = "stsim", versions = "4.0.0", session = mySession) # Uninstalls all instances ofa package from SyncroSim session uninstallPackage(packages = "stsim", session = mySession) ## End(Not run)
This function is designed to facilitate the development of R-based Syncrosim Packages by allowing developers to send messages to the run log.
updateRunLog(..., sep = "", type = "status")
updateRunLog(..., sep = "", type = "status")
... |
One or more objects which can be coerced to character
which are pasted together using |
sep |
character. Used to separate terms. Not NA_character_ |
type |
character. Type of message to add to run log. One of "status", (default) "info", or "warning". |
No returned value, used for side effects
## Not run: # Write a message to run log updateRunLog(msg) # Construct and write a message to run log updateRunLog(msg, additionalMsg, sep = " ") ## End(Not run)
## Not run: # Write a message to run log updateRunLog(msg) # Construct and write a message to run log updateRunLog(msg, additionalMsg, sep = " ") ## End(Not run)
Retrieves or sets the Conda configuration of a SsimLibrary
. Note
that in order to use conda environments, you will first need to ensure that
the conda environment has been created for a given package. You can create
the conda environment for a package using the createCondaEnv
function.
useConda(ssimObject) ## S4 method for signature 'character' useConda(ssimObject) ## S4 method for signature 'SsimLibrary' useConda(ssimObject) useConda(ssimObject) <- value ## S4 replacement method for signature 'logical' useConda(ssimObject) <- value ## S4 replacement method for signature 'SsimLibrary' useConda(ssimObject) <- value
useConda(ssimObject) ## S4 method for signature 'character' useConda(ssimObject) ## S4 method for signature 'SsimLibrary' useConda(ssimObject) useConda(ssimObject) <- value ## S4 replacement method for signature 'logical' useConda(ssimObject) <- value ## S4 replacement method for signature 'SsimLibrary' useConda(ssimObject) <- value
ssimObject |
|
value |
logical for whether to use Conda
environments for the given SyncroSim Library. If set to
|
Logical: whether Conda environments will be used during runtime for the given
SsimLibrary
## Not run: # Set up a SyncroSim Session, SsimLibrary mySession <- session() # Retrieve Conda configuration status of the SsimLibrary useConda(myLibrary) # Set the Conda configuration of the SyncroSim Library useConda(myLibrary) <- TRUE # Only use Conda with the specified SyncroSim packages useConda(myLibrary) <- "helloworld" # Only use Conda with multiple specified SyncroSim packages useConda(myLibrary) <- c("helloworld", "stsim") ## End(Not run)
## Not run: # Set up a SyncroSim Session, SsimLibrary mySession <- session() # Retrieve Conda configuration status of the SsimLibrary useConda(myLibrary) # Set the Conda configuration of the SyncroSim Library useConda(myLibrary) <- TRUE # Only use Conda with the specified SyncroSim packages useConda(myLibrary) <- "helloworld" # Only use Conda with multiple specified SyncroSim packages useConda(myLibrary) <- c("helloworld", "stsim") ## End(Not run)
Retrieves the version of a SyncroSim Session.
version(session = NULL) ## S4 method for signature 'character' version(session = NULL) ## S4 method for signature 'missingOrNULL' version(session = NULL) ## S4 method for signature 'Session' version(session = NULL)
version(session = NULL) ## S4 method for signature 'character' version(session = NULL) ## S4 method for signature 'missingOrNULL' version(session = NULL) ## S4 method for signature 'Session' version(session = NULL)
session |
|
A character string e.g. "2.2.13".
## Not run: # Set SyncroSim Session mySession <- session() # Retrieve version of SyncroSim associated with Session version(mySession) ## End(Not run)
## Not run: # Set SyncroSim Session mySession <- session() # Retrieve version of SyncroSim associated with Session version(mySession) ## End(Not run)