Description Usage Arguments Value See Also Examples
Methods to calculate neighbourhood values for cells in raster maps using
raster::focal
. By default the fraction of non-NA cells
within the moving window (i.e. the size of the weights matrix) devoted to each
land use category is calculated. This behaviour can be changed by altering the
weights matrix or providing an alternative function. The resulting object can
be used as the basis of neighbourhood decision rules.
1 2 3 4 5 6 7 8 9 10 11 12 13 | NeighbRasterStack(x, weights, neighb, ...)
## S4 method for signature 'RasterLayer,list,ANY'
NeighbRasterStack(x, weights, neighb,
categories, fun = mean, ...)
## S4 method for signature 'RasterLayer,matrix,ANY'
NeighbRasterStack(x, weights, neighb,
categories, fun = mean, ...)
## S4 method for signature 'RasterLayer,ANY,NeighbRasterStack'
NeighbRasterStack(x, weights,
neighb)
|
x |
RasterLayer containing categorical data |
weights |
list containing a matrix of weights (the |
neighb |
NeighbRasterStack object. Only used if |
... |
additional arguments to |
categories |
numeric vector containing land use categories for which neighbourhood values should be calculated |
fun |
function. Input argument to |
A NeighbRasterStack object.
NeighbRasterStack-class
, allowNeighb
,
raster::focal
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Plum Island Ecosystems
lu <- DiscreteLulcRasterStack(x=stack(pie[1:3]),
categories=c(1,2,3),
labels=c("Forest","Built","Other"),
t=c(0,6,14))
## create a NeighbRasterStack object for 1985 land use map
w1 <- matrix(data=1, nrow=3, ncol=3, byrow=TRUE)
w2 <- w1
w3 <- w1
nb1 <- NeighbRasterStack(x=lu[[1]],
categories=c(1,2,3),
weights=list(w1,w2,w3))
## update nb2 for 1991
nb2 <- NeighbRasterStack(x=lu[[2]],
neighb=nb1)
## plot neighbourhood map for forest
plot(nb2[[1]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.