getValuesBlock_enhanced: Easier-to-use function for grabbing a block of data out of a...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/getValuesBlock_enhanced.R

Description

Easier-to-use function for grabbing a block of data out of a Raster*.

Usage

1
2
getValuesBlock_enhanced(x, r1 = 1, r2 = nrow(x), c1 = 1, c2 = ncol(x),
  lyrs = seq(nlayers(x)), format = "array", ...)

Arguments

x

Raster* Some input Raster* object.

r1

Numeric. The start row of the chunk.

r2

Numeric. The end row of the chunk.

c1

Numeric. The start column of the chunk.

c2

Numeric. The end row of the chunk.

lyrs

Numeric. Vector of layer IDs. Defaults to all layers (1:nlayers(x)).

format

Character. See Details.

...

Other parameters.

Details

This allows for a larger number of output formats to be generated when extracting chunks of data from a Raster* object. If format="array" (default), the chunk will be returned in a 3-d array with dimensions representing column,row,and layer. If "raster", the chunk will be returned as a Raster* object. If "data.frame", it will be returned as a data.frame. If "data.frame.dims", it will return a list, where the first component (named "values") is the same as the data.frame when using format="data.frame", and the second component (named "dim") is the dimensions of the extracted chunk.

Value

An array or raster object.

Author(s)

Jonathan A. Greenberg

See Also

getValues

Examples

1
2
3
4
5
6
tahoe_highrez <- brick(system.file("external/tahoe_highrez.tif", package="spatial.tools"))
mychunk <- getValuesBlock_enhanced(tahoe_highrez,r1=100,r2=110,c1=20,c2=50)
class(mychunk)
dim(mychunk)
mychunk_raster <- getValuesBlock_enhanced(tahoe_highrez,r1=100,r2=110,c1=20,c2=50,format="raster")
mychunk_raster

azvoleff/spatial.tools documentation built on June 4, 2017, 12:08 a.m.