Learn R Programming

SpaDES.core (version 2.0.5)

loadSimList: Load a saved simList and ancillary files

Description

Loading a simList from file can be problematic as there are non-standard objects that must be rebuilt. See description in saveSimList() for details.

unzipSimList is a convenience wrapper around unzip and loadSimList where all the files are correctly identified and passed to loadSimList(..., otherFiles = xxx). See zipSimList for details.

Usage

loadSimList(
  filename,
  projectPath = getwd(),
  tempPath = tempdir(),
  paths = NULL,
  otherFiles = "",
  verbose = getOption("reproducible.verbose")
)

unzipSimList(zipfile, load = TRUE, paths = getPaths(), ...)

Value

For loadSimList(), a simList object. For unzipSimList(), either a character vector of file names unzipped (if load = FALSE), or a simList object.

Arguments

filename

Character giving the name of a saved simulation file. Currently, only file types .qs or .rds are supported.

projectPath

An optional path for the project within which the simList exists. This is used to identify relative paths for saving and loading the simList.

tempPath

A character string specifying the new base directory for the temporary paths maintained in a simList.

paths

A list of character vectors for all the simList paths. When loading a simList, this will replace the paths of everything to these new paths. Experimental still.

otherFiles

A character vector of (absolute) file names locating each of the existing file-backed Raster* files that are the real paths for the possibly incorrect paths in Filenames(sim) if the the file being read in is from a different computer, path, or drive. This could be the output from unzipSimList (which is calls loadSimList internally, passing the unzipped filenames)

verbose

Numeric, -1 silent (where possible), 0 being very quiet, 1 showing more messaging, 2 being more messaging, etc. Default is 1. Above 3 will output much more information about the internals of Caching, which may help diagnose Caching challenges. Can set globally with an option, e.g., options('reproducible.verbose' = 0) to reduce to minimal

zipfile

Filename of a zipped simList

load

Logical. If TRUE, the default, then the simList will also be loaded into R.

...

passed to unzip

Details

If cache is used, it is likely that it should be trimmed before zipping, to include only cache elements that are relevant.

See Also

saveSimList(), zipSimList()