extract {vegsoup}R Documentation

Extract values from Raster objects

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

## 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

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

[Package vegsoup version 0.2-9 Index]