Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

raster.moments

Raster moments


Description

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

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

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)

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.