Learn R Programming

reproducible (version 1.1.1)

.prepareOutput: Make any modifications to object recovered from cacheRepo

Description

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

Usage

.prepareOutput(object, cacheRepo, ...)

# S4 method for Raster .prepareOutput( object, cacheRepo, drv = getOption("reproducible.drv", RSQLite::SQLite()), conn = getOption("reproducible.conn", NULL), ... )

# 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 passed to FUN

drv

an object that inherits from '>DBIDriver, or an existing '>DBIConnection object (in order to clone an existing connection).

conn

A '>DBIConnection object, as returned by dbConnect().

Value

The object, modified

Examples

Run this code
# NOT RUN {
a <- 1
.prepareOutput(a) # does nothing

b <- "Null"
.prepareOutput(b) # converts to NULL

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())
# }

Run the code above in your browser using DataLab