getValuesFocal

0th

Percentile

Get focal raster cell values

This function returns a matrix (or matrices) for all focal values of a number of rows of a Raster* object

Keywords
methods, spatial
Usage
# S4 method for Raster
getValuesFocal(x, row, nrows, ngb, names=FALSE, padValue=NA, array=FALSE, ...)
Arguments
x

Raster* object

row

Numeric. Row number, should be between 1 and nrow(x). Can be omitted to get all rows

nrows

Numeric. Number of rows, should be a positive integer smaller than row+nrow(x). Should be omitted if row is omitted

ngb

Neighbourhood size. Either a single integer or a vector of two integers c(nrow, ncol)

names

logical. If TRUE, the matrix returned has row and column names

padValue

numeric. The value of the cells of the "padded" rows and columns. That is 'virtual' values for cells within a neighbourhood, but outside the raster

array

logical. If TRUE and x has multiple layers, an array is returned in stead of a list of matrices

...

additional arguments (none implemented)

Value

If x has a single layer, a matrix with one row for each focal cell, and one column for each neighbourhood cell around it.

If x has multiple layers, an array (if array=TRUE) or a list of such matrices (one list element (matrix) for each layer)

See Also

getValues, focal

Aliases
  • getValuesFocal
  • getValuesFocal,Raster-method
  • getValuesFocal,Raster,missing,missing,numeric-method
  • getValuesFocal,Raster,numeric,numeric,numeric-method
Examples
library(raster) # NOT RUN { r <- raster(nr=5, nc=5, crs='+proj=utm +zone=12') r[] <- 1:25 as.matrix(r) getValuesFocal(r, row=1, nrows=2, ngb=3, names=TRUE) getValuesFocal(stack(r,r), row=1, nrows=1, ngb=3, names=TRUE, array=TRUE) # }
Documentation reproduced from package raster, version 2.6-7, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.