runProjects: Run all models of a StoX project

View source: R/API.R

runProjectsR Documentation

Run all models of a StoX project

Description

This function runs and returns output from all models of a StoX project.

Usage

runProjects(
  projectPaths,
  modelNames = getRstoxFrameworkDefinitions("stoxModelNames"),
  processes = NULL,
  startProcess = 1,
  endProcess = Inf,
  drop.datatype = TRUE,
  unlistDepth2 = FALSE,
  run = TRUE,
  save = TRUE,
  force.save = FALSE,
  force.restart = FALSE,
  replaceDataList = list(),
  replaceArgsList = list(),
  prependProcessList = list(),
  fileOutput = NULL,
  setUseProcessDataToTRUE = TRUE,
  purge.processData = FALSE,
  returnModelData = TRUE,
  try = TRUE,
  unlist.models = FALSE,
  close = FALSE,
  ...
)

Arguments

projectPaths

A vector of paths to the StoX projects.

modelNames

The name of the models (possible values are "baseline", "analysis" and "report").

processes

The name of the processes.

startProcess

The process index, name or ID at which to start the model run. A list can be given named by the models if one needs to specify start process for each model. Models given inn modelNames but not in the list will be run from the start of the model.

endProcess

The process index, name or ID at which to stop the model run. A list can be given named by the models if one needs to specify end process for each model. Models given inn modelNames but not in the list will be run to the end of the model.

drop.datatype

Logical: If TRUE, drop the top level of the output list if it has length 1 and that single element is named by the datatype name.

unlistDepth2

Logical: Related to drop.datatype, but setting this to TRUE unlists output data that are nested in 2 levels, such as output from ReadBiotic, which outputs a set of tables for each input file. Using unlistDepth2 = TRUE puts all these tables in one list, and uses the concatenation of the file names and the table name separated by underscore. This is how it is displayed in the StoX GUI when selecting "View output".

run

Logical: If TRUE run the model.

save

Logical: If TRUE save the project before closing. Default (NULL) is to ask the user whether to save the project before closing.

force.save

If no changes are made to the project, force save anyway. Overrides the save option.

force.restart

Logical: If TRUE, start the processes even if the status file indicating that the model is being run exists. This is useuful when something crached in a preivous run, in which case the model is still appearing as running.

replaceDataList

A list named by the processes to replace output data for. See runProcess.

replaceArgsList

A list of replaceArgs holding parameters to replace in the function call, named by the processes to modify.

prependProcessList

A list of values used in prependProcess, named by the processes to prepend a process to.

fileOutput

Logical: If TRUE save the output as a text file (or other format specified by the class or attributes of the output). If NULL (defafult) use the corresponding parameter of the process.

setUseProcessDataToTRUE

Logical: If TRUE set the UseProcessData function parameter to TRUE in the process memory after execution, if the process is a ProcessData process.

purge.processData

Logical: If TRUE replace process data entirely.

returnModelData

Logical: If TRUE return the output of the model runs. Can also be given as a string vector holding the names of the models to return data from. If TRUE, the specific models to return data from (across models) can be given by processes.

try

Logical: If FALSE do not run the process in a tryCatch. Set this to FALSE when debugging, as the tryCatch masks the errors in the traceback.

unlist.models

Logical: If TRUE unlist the top level so that all processes are in one list.

close

Logical: (In copyProject) If TRUE, close the project after copying.

...

replaceArgsList can also be given directly.

Value

A list of model output.


StoXProject/RstoxFramework documentation built on Oct. 17, 2023, 1:24 p.m.