scenario: Create or open Scenario(s)

Description Usage Arguments Details Value Examples

View source: R/scenario.R

Description

Create or open one or more Scenarios from a SsimLibrary.

Usage

1
2
3
4
5
6
7
8
9
scenario(
  ssimObject = NULL,
  scenario = NULL,
  sourceScenario = NULL,
  summary = NULL,
  results = FALSE,
  forceElements = FALSE,
  overwrite = FALSE
)

Arguments

ssimObject

SsimLibrary or Project object, or character (i.e. a filepath)

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 NULL (Default), new Scenarios will be copies of the sourceScenario

summary

logical. If TRUE then loads and returns the Scenario(s) in a named vector/dataframe with the scenarioId, name, description, owner, dateModified, readOnly, parentID. Default is TRUE if scenario=NULL, FALSE otherwise

results

logical. If TRUE only return result Scenarios. Default is FALSE

forceElements

logical. If TRUE then returns a single Scenario as a named list; if FALSE (default), returns a single Scenario as a Scenario object. Applies only when summary=FALSE

overwrite

logical. If TRUE an existing Scenario will be overwritten. Default is FALSE

Details

For each element of Scenario:

Value

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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)

rsyncrosim documentation built on Oct. 28, 2021, 1:07 a.m.