grd_extract: Extract values from a grid

View source: R/grd-extract.R

grd_extractR Documentation

Extract values from a grid

Description

Unlike grd_subset(), which subsets like a matrix, grd_extract() returns values.

Usage

grd_extract(grid, i = NULL, j = NULL)

grd_extract_nearest(grid, point, out_of_bounds = c("censor", "squish"))

grd_data_extract(grid_data, i = NULL, j = NULL)

Arguments

grid

A grd_xy(), grd_rct(), or other object implementing ⁠grd_*()⁠ methods.

i, j

Index values as in grd_subset() except recycled to a common size.

point

A handleable of points.

out_of_bounds

One of 'keep', 'censor', 'discard', or 'squish'

grid_data

The data member of a grd(). This is typically an array but can also be an S3 object with an array-like subset method. The native raster is special-cased as its subset method requires non-standard handling.

Value

A matrix or vector with two fewer dimensions than the input.


wk documentation built on Oct. 12, 2024, 1:07 a.m.