app: Apply a function to the cells of a SpatRaster
Description
Apply a function to values of each cell of a SpatRaster. This is similar to apply -- think of each layer in a SpatRaster as a column (or row) in a matrix.
positive integer. If nodes > 1, a 'parallel' package cluster with that many nodes is created. Ignored for C++ level implemented functions "max", "min", "mean", "range", "prod", "sum", "any", and "all"
To speed things up, parallelization is supported, but this is often not helpful, and it may actually be slower. There is only a speed gain if you have many cores (> 8) and/or a very complex (slow) function fun. If you write fun yourself, consider supplying a cppFunction made with the Rcpp package instead (or go have a cup of tea while the computer works for you).