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) character vector of map unit labels to be sampled column name in attribute table containing map unit labels a list containing raster names and paths, see details below target sampling density in points per acre percentiles for polygon area stats, e.g. (0.05, 0.25, 0.5, 0.75, 0.95) logical, print a progress bar while sampling? estimate an effective sample size via Moran's I? Column name containing unique polygon IDs; default: 'pID'; calculated if missing

## 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 a 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.

## 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)

## Author

D.E. Beaudette

constantDensitySampling, sample.by.poly