Calculate method for the RasterArray object
Calculate values for a new RasterLayer/RasterArray object from another RasterArray object, using a formula.
## S4 method for signature 'RasterArray,'function'' calc(x, fun, margin = NULL, na.rm = NULL, forcefun = FALSE, forceapply = FALSE)
x |
A RasterArray class object. |
fun |
function to be applied. |
margin |
The |
na.rm |
Remove NA values, if supported by 'fun' (only relevant when summarizing a multilayer Raster object into a RasterLayer) |
forcefun |
logical. Force calc to not use fun with apply; for use with ambiguous functions and for debugging (see Details) |
forceapply |
logical. Force calc to use fun with apply; for use with ambiguous functions and for debugging (see Details) |
The method is an extension of the calc
function. The strucuture expressed as the RasterArray's dimensions allows the calculations to be iterated for different margins of the array, similarly to the apply
function, controlled by the margin
argument.
A RasterLayer
or RasterArray class object.
data(dems) d2 <- cbind(dems, dems) double <- calc(d2, margin=1, fun=sum)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.