raster: Extract values from Raster objects

Description Usage Arguments Details Value Author(s) Examples

Description

Extract the values of the cells of a "raster*" object for the locations (SpatialPoints) of a Vegsoup object; that is perform a spatial query.

Usage

1
2
## S4 method for signature 'Vegsoup'
extract(x, y, ...) 

Arguments

x

A Raster* object.

y

A Vegsoup* object.

...

Additional arguments passed to extract.

Details

See the the documentation of extract in raster for details and additional arguments.

Value

A vector for RasterLayer objects and a matrix for a RasterStack or RasterBrick object. A list if a buffer argument is used or data.frame df=TRUE.

Author(s)

Roland Kaiser

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
require(raster)

# RasterLayer
r1 <- raster(ncol = 10, nrow = 10, xmn = 0, xmx = 1, ymn = 0, ymx = 1)
r1[] <- sample(1:ncell(r1))

x <- coenoflex()

plot(r1)
points(x)

extract(r1, x) # a vector

# RasterStack and RasterBrick
r2 <- raster(ncol = 10, nrow = 10, xmn = 0, xmx = 1, ymn = 0, ymx = 1)
r2[] <- sample(1:ncell(r2))

s <- stack(r1, r2)
b <- brick(r1, r2)
extract(s, x) # a matrix
extract(b, x) # a matrix

vegsoup documentation built on Feb. 24, 2021, 3 a.m.