View source: R/saveLoadSimList.R
saveSimList | R Documentation |
simList
object to diskSaving a simList
may not work using the standard approaches
(e.g., save
, saveRDS
, and qs::qsave
).
There are 2 primary reasons why this doesn't work as expected:
the activeBindings
that are in place within modules
(these allow the mod
and Par
to exist), and file-backed objects,
such as SpatRaster
and Raster*
.
Because of these, a user should use saveSimList
and loadSimList
.
These will save the object and recover the object using the filename
supplied,
if there are no file-backed objects.
If there are file-backed objects, then it will save an archive
(default is .tar.gz
using the archive
package for non-Windows and zip()
if using Windows, as there is currently an unidentified bug in archive*
on Windows).
The user does not need to specify the filename any differently,
as the code will search based on the filename without the file extension.
saveSimList(
sim,
filename,
projectPath = getwd(),
outputs = TRUE,
inputs = TRUE,
cache = FALSE,
envir,
...
)
sim |
Either a |
filename |
Character string with the path for saving |
projectPath |
Should be the "top level" or project path for the |
outputs |
Logical. If |
inputs |
Logical. If |
cache |
Logical. Not yet implemented. If |
envir |
If |
... |
Additional arguments. See Details. |
There is a family of 2 functions that are mutually useful for saving and
loading simList
objects and their associated files (e.g., file-backed
Raster*
, inputs
, outputs
, cache
) saveSimList()
, loadSimList()
.
Additional arguments may be passed via ...
, including:
files
: logical indicating whether files should be included in the archive.
if FALSE
, will override cache
, inputs
, outputs
, setting them to FALSE
.
symlinks
: a named list of paths corresponding to symlinks, which will be used to substitute
normalized absolute paths of files.
Names should correspond to the names in paths()
;
values should be project-relative paths.
E.g., list(cachePath = "cache", inputPath = "inputs", outputPath = "outputs")
.
Invoked for side effects of saving both a .qs
(or .rds
) file,
and a compressed archive (one of .tar.gz
if using non-Windows OS or .zip
on Windows).
loadSimList()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.