Learn R Programming

FSK2R (version 0.2.0)

run_simulation: Run one simulation in an FSK object

Description

Runs the simulation corresponding to index. If defined, it also calls any visualization script. Returns all user-created variables from the simulation environment, supporting various data types including scalars, vectors, data frames, lists, and matrices.

Usage

run_simulation(
  fsk_object,
  index,
  run_visualization = FALSE,
  copy_workspace = FALSE,
  workspace_mode = "all",
  inject_to_global = FALSE
)

Value

A named list containing all variables created by the simulation model. Each element preserves the original data type (numbers, strings, data frames, lists, matrices, etc.). Returns an empty list if no variables are created. When inject_to_global=TRUE, variables are also available in the global environment.

Arguments

fsk_object

Instance of FSK2R

index

Index of the simulation

run_visualization

Whether to call the visualization script. FALSE by default.

copy_workspace

Whether to copy the simulation workspace to the user's working directory. FALSE by default.

workspace_mode

What to copy when copy_workspace=TRUE. Options: "all" (copy everything), "generated" (copy only files created during simulation), "modified" (copy only files modified during simulation). Default is "all".

inject_to_global

Whether to inject simulation variables into the user's global environment for seamless model chaining. FALSE by default for backward compatibility.