exactextractr is an R package that quickly and accurately summarizes raster values over polygonal areas, commonly referred to as zonal statistics. Unlike most zonal statistics implementations, exactextractr handles grid cells that are partially covered by a polygon. Typical performance for real-world applications is orders of magnitude faster than the
raster package. Calculations are performed using the C++
exactextract tool. exactextractr can summarize raster values using several named operations as well as arbitrary R functions. Where applicable, a named operation will provide better performance and reduced memory usage relative to an equivalent R function. Named operations are specified by providing a character vector with one or more operation names to the
fun parameter of
Available summary operations include count, mode, max, mean, median, quantile, min, minority, sum, variety, variance, stdev, and coefficient of variation. Additionally, weighted mean and weighted sums can be performed with a secondary raster layer.