dgg_extract: Extract raster data with a DGG shapefile

View source: R/dgg_extract.R

dgg_extractR Documentation

Extract raster data with a DGG shapefile

Description

Given a stars data object and shapefile, extracts the relevant data using exactextractr::exact_extract(). Stars inputs should be in raster format with x and y dimensions. This function is planned for deprecation whenever direct support for exact_extract() is better supported via stars::aggregate().

Usage

dgg_extract(dat, dgg, var = NULL, fun, progress = FALSE)

Arguments

dat

The raster data to extract.

dgg

Shapefile containing the DGG boundaries to use for the extraction.

var

The variable to extract.

fun

The function to pass to exactextractr::exact_extract().

progress

Display the exactextractr::exact_extract() progress bar.

Examples

dgg_extract(hyde_med, dgg_med, 'crops', 'sum')

nick-gauthier/anthromes-12k documentation built on June 26, 2022, 3:21 p.m.