create_scenario: Create, set, and get scenario.

Description Usage Arguments Value Examples

View source: R/scenario.R

Description

A scenario folder is where you organise and store the scripts, the data and the models that associate with a microsimulation model implementation. This is a recommended practice for dymium models.

create_scenario: creates a scenario folder inside the scenarios folder, which will be created if not already exists, at the root folder of your active RStudio project. The standard structure of a scenario folder contains an 'inputs' folder, an 'outputs' folder inside. However, if the scenario is already existed then it this will set that scenario to active if active is TRUE. When you call a dymium function such as dm_save, it will automatically save the data to the outputs folder of the currently active scenario.

set_active_scenario: is useful for event functions to access the current active scenario directory. If the scenerio folder doesn't have 'inputs' and 'ouputs' folders then they will be created.

get_active_scenario: returns a list of 3 elements: 'scenario, 'inputs' and 'outputs' directories.

Usage

1
2
3
4
5
create_scenario(name, active = TRUE, .basedir = here::here())

set_active_scenario(name, .basedir = here::here())

get_active_scenario()

Arguments

name

:: character(1)
Name of the scenario

active

:: logical(1)\cr Default as TRUE'. Set the newly created scenario as active scenario.

.basedir

:: character(1)
The base directory that the downloaded module will be saved at. here::here() is used to provide the default value which is is the root folder of the active RStudio project.

Value

create_ and set_ invisibly returns the scenario path and get_ returns a named list.

Examples

1
2
3
4
5
6
## Not run: 
create_scenario(name = "test", active = FALSE)
set_active_scenario(name = "test")
get_active_scenario()

## End(Not run)

dymium-org/dymiumCore documentation built on July 18, 2021, 5:10 p.m.