zonal_pipe: Zonal statistics using a raster and a vector zone layer

Description Usage Arguments Value Examples

View source: R/zonal_stats.R

Description

Perform raster zonal statistics from a vector zone layer and add the results to the attribute layer of the vector layer.

Usage

1
zonal_pipe(r, z, stats, filename = NULL)

Arguments

r

A raster file for which one wishes to compute zonal statistics

z

A vector layer (e.g. a shapefile) containing one polygon for each zone used to derive zonal statics (e.g. admnistrative areas)

stats

The function applied on all pixels of an area (i.e. the zonal statistics)

filename

The path where to write the vector layer with the result of the zonal statistics. If set to NULL returns the vector layer object (already).

Value

A vector layer with the zonal statistics for each band of the input raster added in the attribute table

Examples

1
output <- zonal_pipe(precipitation, belgium, stats = "mean")

damienjacques/gurugis documentation built on Aug. 3, 2020, 12:58 p.m.