Wrapper to the raster function, that creates the raster object in memory, even if it was read in from file. There is the default method which is just a pass through, so this can be safely used on large complex objects, recursively, e.g., a simList.

rasterToMemory(x, ...)

# S4 method for class 'list'
rasterToMemory(x, ...)

# S4 method for class 'character'
rasterToMemory(x, ...)

# S4 method for class 'ANY'
rasterToMemory(x, ...)

# S4 method for class 'simList'
rasterToMemory(x, ...)

Arguments

x

An object passed directly to the function raster (e.g., character string of a filename).

...

Additional arguments to raster::raster, raster::stack, or raster::brick.

Value

A raster object whose values are stored in memory.

See also

raster(), terra::rast().

Author

Eliot McIntire and Alex Chubaty