# to show the packages added, plus create scenarios to show below
library(rsyncrosim)
mySession <- session()
myLibrary <- ssimLibrary("Changes to rsyncrosim v2.ssim", overwrite = T)
addPackage(myLibrary, packages = c("stsim", "helloworldSpatial"))
scenario1 <- scenario(myLibrary, scenario = "Scenario 1")
scenario2 <- scenario(myLibrary, scenario = "Scenario 2")
scenario3 <- scenario(myLibrary, scenario = "Scenario 3")
myScenario <- scenario(myLibrary, "my Scenario")
dependency(myScenario) <- "Scenario 1"

The introduction of SyncroSim Studio brought some structural changes and new features, which are reflected in the rsyncrosim package. Use the guide below to update your rsyncrosim v1 scripts to be compatible with rsyncrosim v2.

Note: SyncroSim v3.0.9 or higher is required to use rsyncrosim v2.0.0 or higher.

Updated functions

Installing/uninstalling packages

Previously, the addPackage and removePackage functions were used to install and uninstall packages from SyncroSim. Now to install and uninstall packages from SyncroSim, use:

# Installs the selected package(s) to SyncroSim
installPackage()  

# Uninstalls the selected package(s) from SyncroSim
uninstallPackage() 

You can also have multiple versions of a package installed. Use the versions argument in the installPackage() function to specify which version of the package you would like to install. If you do not specify a version, then the latest version of the package will be installed.

# Install ST-Sim version 4.0.0
installPackage(myLibrary, packages = "stsim", versions = "4.0.0")

# Install the latest version of ST-Sim on the package server
installPackage(myLibrary, packages = "stsim")

You can also use the versions argument in the uninstallPackage() function to specify which version you would like to uninstall. If you do not specify a version, then all versions of that package will be uninstalled.

# Uninstall ST-Sim version 4.0.0
uninstallPackage(myLibrary, packages = "stsim", versions = "4.0.0")

# Uninstall all installed versions of ST-Sim
uninstallPackage(myLibrary, packages = "stsim")

Adding/removing packages

Now you can use multiple SyncroSim packages in a single library. To add and remove packages from your library, use:

# Adds package(s) to the library
addPackage()    

# Removes package(s) from the library
removePackage() 

Note: when you remove a package from your library any associated datasheets will be removed as well.

You can also choose which package version to use within a library. Use the versions argument in the addPackage() function to load a specific version of a package in a library, or to change the version of a package that the library uses.

# Add ST-Sim version 4.0.0 to your library
addPackage(myLibrary, packages = "stsim", versions = "4.0.0")

# Update the version of ST-Sim that your library uses
addPackage(myLibrary, packages = "stsim", versions = "4.0.1")

You do not need to specify a version when removing a package using removePackage() because only one version of a package can be loaded in a library at a time.

Creating libraries

Now that addon packages no longer exist and SyncroSim libraries can support multiple packages, the following changes have been made to the ssimLibrary() function:

# rsyncrosim version 1:
myLibrary <- ssimLibrary(package = "PackageName", addon = "AddonName")

# rsyncrosim version 2:
myLibrary <- ssimLibrary(packages = c("stsim", "helloworldSpatial"))

Library information

Since multiple packages can be loaded in a library, the info(ssimLibrary) no longer returns the following library attributes:

In addition, now that you can link models from various packages in a pipeline, and outputs from one transformer can be inputs to the next transformer in a pipeline, the Input and Output folders have been combined into a single Data folder. See the Introduction to rsyncrosim for details.

Dependencies

Scenario dependencies are now set using the <- operator in rsyncrosim. See below for examples on how the usage of the dependency() function has changed.

To view the existing dependencies for a scenario:

dependency(myScenario)

To set dependencies for a scenario:

# rsyncrosim version 1:
dependency(myScenario, dependency = c("Scenario 2", "Scenario 3"))
# rsyncrosim version 2:
dependency(myScenario) <- c("Scenario 2", "Scenario 3")

dependency(myScenario)

Note: this will remove any previously set dependencies unless the existing dependencies are also included in the vector.

Multiprocessing

The run() function no longer contains the jobs argument for setting the number of cores to use during a multiprocessing run. Instead, use the core_Multiprocessing library datasheet to set the number of cores.

multiprocessing <- data.frame(EnableMultiprocessing = TRUE,
                              MaximumJobs = 6)

saveDatasheet(myLibrary, multiprocessing, "core_Multiprocessing")

Note: because the core_Multiprocessing datasheet is library-scoped, modifying this datasheet will affect every scenario run.

Deprecated functions

Addon functions

In SyncroSim 3, the concept of addon packages no longer exists. All addon packages have either been converted to standalone packages (e.g., burnP3PlusPrometheus), and can be added to a library without having to load a base package first, or incorporated directly into its base package (e.g., stsimsf is now part of stsim). Therefore, the following functions have been removed:

Update functions

The following update functions have been removed:

Raster functions

The following deprecated raster function has been removed:

Breakpoint functions

Setting, catching, and removing breakpoints in rsyncrosim scripts in no longer supported, so the following breakpoint functions have been removed:

Variable naming

The primary key column for all SyncroSim datasheets has been modified slightly. The ID in the primary key is now Id for all datasheets. This also applies to column names in scenario-scoped datasheets that reference values taken from project-scoped datasheets. It is generally safe to substitute ID for Id throughout your script, but it's recommended to check the datasheet's variable names.

Below is an example of a datasheet with the new naming convention for primary keys:

datasheet(myScenario, "stsim_FlowPathway", includeKey = TRUE)

Core datasheets

The system datasheets, previously identified by the prefix corestime_, are now prefixed by core_.

Other NEW functions

Below is a list of other new functions that have been added to rsyncrosim v2. For more information, on these new functions, refer to the reference guide.

# creates the conda environment for the selected package(s)
createCondaEnv()

# deletes a SyncroSim library (IRREVERSIBLE)
deleteLibrary() 

# Create, load, or modify SyncroSim charts using the new Chart class
chart() 


syncrosim/rsyncrosim documentation built on June 15, 2025, 8:21 a.m.