powered by
Apply a function that (arithmetically) operates to individual cells and layers of a SpatRaster, to return the same number of layers as in the input SpatRaster. That, is unlike with app, without summarizing over layers.
app
# S4 method for SpatRaster arith(x, fun, ..., filename="", overwrite=FALSE, wopt=list())
SpatRaster
function
additional arguments for fun
fun
character. Output filename. Optional
logical. If TRUE, filename is overwritten
TRUE
filename
list. Options for writing files as in writeRaster
writeRaster
arith
# NOT RUN { r <- rast(ncols=10, nrows=10) values(r) <- 1:ncell(r) x <- arith(r, sqrt) # equivalent to y <- sqrt(x) # }
Run the code above in your browser using DataLab