Saves a simList to an RDS file via SpaDES.core::saveSimList(). Heavy ancillary data (inputs, outputs, cache, files) are excluded so the file contains only the simulation state; pair with outTar() to bundle the output files separately.

outSave(
  sim,
  runName,
  simFilename = NULL,
  lazy = TRUE,
  verbose = getOption("reproducible.verbose", 1)
)

Arguments

sim

A simList object.

runName

Character scalar. Used as the base name for the saved sim file and tarball.

simFilename

Character scalar. Full path for the .rds file. Defaults to SpaDES.core::simFile(name = runName, path = outputPath(sim), time = end(sim), ext = "rds").

lazy

Logical. Passed to SpaDES.core::saveSimList(). When TRUE (default), each user object in sim@.xData and each module's mod objects in sim@.xData$.modObjs are written to their own file in a sibling <simFilename sans ext>_lazy/ directory, and lazily restored on load via delayedAssign. outTar() picks up that directory automatically.

verbose

Numeric message level, forwarded to SpaDES.core::saveSimList(). Defaults to getOption("reproducible.verbose", 1) – note the fallback: saveSimList() resolves its own default as a bare getOption("reproducible.verbose"), and passes the result to Require::messageVerbose(), whose if (verbose >= verboseLevel) fails with "argument is of length zero" whenever that option happens to be unset.

Value

Invisibly returns simFilename.