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)

Arguments

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

Session object. If NULL(default), the default session will be used

program

character. The name of the target SyncroSim executable. Options include "SyncroSim.Console.exe" (default), "SyncroSim.Server.exe", "SyncroSim.PackageManager.exe" and "SyncroSim.Multiband.exe"

wait

logical. If TRUE(default) R will wait for the command to finish before proceeding. Note that silent(session) is ignored if wait=FALSE

Value

Character string: output from the SyncroSim program.

Details

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"

Examples

# \donttest{ # Install "stsim" if not already installed addPackage("stsim")
#> Package <stsim> is already installed
# 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))
#> [1] "--version" #> [1] "--create --library --name=C:\\Users\\birch\\AppData\\Local\\Temp\\RtmpiArgKt/testlib.ssim --package=stsim"
output
#> character(0) #> attr(,"status") #> [1] 65535
# Provide arguments to the command line using an unnamed vector command(c("create", "help"))
#> [1] "Creates an item" #> [2] "usage: --create [arguments]" #> [3] "" #> [4] " --library Creates a library." #> [5] " --addon Creates an add-on." #> [6] " --folder Creates a folder." #> [7] " --project Creates a project." #> [8] " --scenario Creates a scenario." #> [9] " --result Creates a result scenario." #> [10] " --dependency Creates a scenario dependency." #> [11] " --help Prints help for an argument."
# Provide arguments to the command line using a character string command("--create --help")
#> [1] "Creates an item" #> [2] "usage: --create [arguments]" #> [3] "" #> [4] " --library Creates a library." #> [5] " --addon Creates an add-on." #> [6] " --folder Creates a folder." #> [7] " --project Creates a project." #> [8] " --scenario Creates a scenario." #> [9] " --result Creates a result scenario." #> [10] " --dependency Creates a scenario dependency." #> [11] " --help Prints help for an argument."
# Provide arguments to the command line using a named list command(list(create = NULL, help = NULL))
#> [1] "Creates an item" #> [2] "usage: --create [arguments]" #> [3] "" #> [4] " --library Creates a library." #> [5] " --addon Creates an add-on." #> [6] " --folder Creates a folder." #> [7] " --project Creates a project." #> [8] " --scenario Creates a scenario." #> [9] " --result Creates a result scenario." #> [10] " --dependency Creates a scenario dependency." #> [11] " --help Prints help for an argument."
# Call on a different program to find all installed packages command(list(installed = NULL), program = "SyncroSim.PackageManager.exe")
#> [1] "demodigits Demo Digits 1.0.0 " #> [2] "epi Epidemic Base Package 1.1.0 " #> [3] "epiDataBc BC COVID-19 Data 1.0.0 " #> [4] "epiDataCanada Canadian COVID-19 Data 1.0.0 " #> [5] "epiDataWorld World COVID-19 Data 1.0.0 " #> [6] "epiForecastIHME IHME COVID-19 Forecasts 1.0.0 " #> [7] "epiModelDeathHospital Death + Hospitalization Model 1.0.0 " #> [8] "epiModelVocVaccine VOC + Vaccine Model 1.0.0 " #> [9] "epiPublish Data Publication 1.0.0 " #> [10] "epiTransform Remove Seasonal Effects 1.0.0 " #> [11] "helloworld Hello World Package 1.0.0 " #> [12] "helloworldPipeline Example demonstrating how to use pipelines 1.0.0 " #> [13] "helloworldPipelinePy Example demonstrating how to use pipelines with python 1.0.0 " #> [14] "helloworldSpatial Example demonstrating how to use spatial data 1.0.1 " #> [15] "helloworldTime Example demonstrating how to use timesteps 1.0.0 " #> [16] "helloworldTimePy Example demonstrating how to use timesteps with a python model 1.0.0 " #> [17] "helloworldUncertainty Example demonstrating how to use iterations 1.0.0 " #> [18] "helloworldUncertaintyPy Example demonstrating how to use iterations with python 1.0.0 " #> [19] "landfirevegmodels Landfire vegetation models 1.1.0 " #> [20] "lucas Land Use and Carbon Scenario Simulator (LUCAS) 1.0.5 " #> [21] "modelKarlenPypm Karlen PyPm Model 1.0.0 " #> [22] "netlogo Runs the NetLogo agent-based modeling environment 1.2.0 " #> [23] "stconnect Connectivity planning for future climate and land-use change 1.1.14 " #> [24] "stsim The ST-Sim state-and-transition simulation model 3.3.3 " #> [25] "stsimecodep Calculates ecological departure in ST-Sim using the LANDFIRE Fire Regime Condition Class 3.3.0 " #> [26] "stsimsf Integrates stocks and flows into the ST-Sim simulation model 3.3.2 "
# }