Sample a raster stack by map unit polygons, at a constant density.

sampleRasterStackByMU(
  mu,
  mu.set,
  mu.col,
  raster.list,
  pts.per.acre,
  p = c(0, 0.05, 0.25, 0.5, 0.75, 0.95, 1),
  progress = TRUE,
  estimateEffectiveSampleSize = TRUE,
  polygon.id = "pID"
)

Arguments

mu

a SpatialPolygonsDataFrame object in a projected coordinate reference system (CRS)

mu.set

character vector of map unit labels to be sampled

mu.col

column name in attribute table containing map unit labels

raster.list

a list containing raster names and paths, see details below

pts.per.acre

target sampling density in points per acre

p

percentiles for polygon area stats, e.g. c(0.05, 0.25, 0.5, 0.75, 0.95)

progress

logical, print a progress bar while sampling?

estimateEffectiveSampleSize

estimate an effective sample size via Moran's I?

polygon.id

Column name containing unique polygon IDs; default: "pID"; calculated if missing

Value

A list containing:

raster.samples

a data.frame containing samples from all rasters in the stack

area.stats

a data.frame containing area statistics for all map units in the collection

unsampled.ids

an index to rows in the original SPDF associated with polygons not sampled

raster.summary

a data.frame containing information on sampled rasters

Moran_I

a data.frame containing estimates Moran's I (index of spatial autocorrelation)

Details

This function is used by various NRCS reports that summarize or compare concepts defined by collections of polygons using raster data sampled from within each polygon, at a constant sampling density. Even though the function name includes "RasterStack", this function doesn't actually operate on the "stack" object as defined in the raster package. The collection of raster data defined in raster.list do not have to share a common coordinate reference system, grid spacing, or extent. Point samples generated from mu are automatically converted to the CRS of each raster before extracting values. The extent of each raster in raster.list must completely contain the extent of mu.

Author

D.E. Beaudette