This is a generic definition that can be extended according to class.

.prepareOutput(object, cacheRepo, ...)

# S4 method for RasterLayer
.prepareOutput(object, cacheRepo, ...)

# S4 method for ANY
.prepareOutput(object, cacheRepo, ...)

Arguments

object

Any R object

cacheRepo

A repository used for storing cached objects. This is optional if Cache is used inside a SpaDES module.

...

Arguments of FUN function .

Value

The object, modified

Examples

a <- 1 .prepareOutput(a) # does nothing
#> [1] 1
b <- "Null" .prepareOutput(b) # converts to NULL
#> NULL
# For rasters, it is same as .prepareFileBackedRaster try(archivist::createLocalRepo(tempdir()))
#> Directory /tmp/RtmpqKjqWd does exist and contain the backpack.db file. Use force=TRUE to reinitialize.
library(raster) r <- raster(extent(0,10,0,10), vals = 1:100) # write to disk manually -- will be in tempdir() r <- writeRaster(r, file = tempfile()) # copy it to the cache repository r <- .prepareOutput(r, tempdir())