powered by
Apply a function to values of a SpatRaster. Similar to apply
apply
# S4 method for SpatRaster app(x, fun, ..., filename="", overwrite=FALSE, wopt=list())
SpatRaster object
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
SpatRaster
overlay, math
overlay
# NOT RUN { r <- rast(ncols=10, nrows=10) values(r) <- 1:ncell(r) x <- c(r, r, r) s <- app(x, fun=sum) # }
Run the code above in your browser using DataLab