mc_save: Save and load movecost objects across R sessions
Description
movecost result objects contain terra SpatRaster components, which
hold pointers to external memory and therefore cannot be stored with plain
saveRDS()/readRDS(). mc_save() wraps all raster
components (via terra::wrap()) before serialising; mc_load()
restores them. igraph components are serialised natively.
Usage
mc_save(x, file)
mc_load(file)
Value
mc_save() returns file invisibly; mc_load()
returns the restored object.
Arguments
x
a movecost result object.
file
path of the file to write/read (conventionally with extension
.rds).