raster.moments
From spatialEco v1.3-2
by Jeffrey S Evans
Raster moments
Calculates focal statistical moments of a raster
Usage
raster.moments(x, type = "mean", s = 3, p = 0.75)
Arguments
- x
raster object
- type
The global statistic to represent the local deviation options are: "min", "min", "mean", "median", "var, "sd", "mad", "kurt", "skew", "quantile"
- s
Size of matrix (focal window), can be single value or two values defining the [x,y] dimensions of the focal matrix
- p
if type="quantile", the returned percentile.
Value
raster class object of the local distributional moment
Note
This is a simple wrapper for the focal function, returning local statistical moments
Examples
# NOT RUN {
library(raster)
r <- raster(nrows=100, ncols=100, xmn=571823, xmx=616763,
ymn=4423540, ymx=4453690)
proj4string(r) <- crs("+proj=utm +zone=12 +datum=NAD83 +units=m +no_defs")
r[] <- runif(ncell(r), 1000, 2500)
r <- focal(r, focalWeight(r, 150, "Gauss") )
# Calculate 10th percentile for 3x3 window
r.p10 <- raster.moments(r, type="quantile", p=0.10)
# }
# NOT RUN {
# }
Community examples
Looks like there are no examples yet.