NeighbRasterStack: Create a NeighbRasterStack object

Description Usage Arguments Value See Also Examples

Description

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.

Usage

 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)

Arguments

x

RasterLayer containing categorical data

weights

list containing a matrix of weights (the w argument in raster::focal) for each land use category. The order of list or vector elements should correspond to the order of land use categories in categories

neighb

NeighbRasterStack object. Only used if categories and weights are not provided. This option can be useful when existing NeighbRasterStack objects need to be updated because a new land use map is available, such as during the allocation procedure.

...

additional arguments to raster::focal

categories

numeric vector containing land use categories for which neighbourhood values should be calculated

fun

function. Input argument to focal. Default is mean

Value

A NeighbRasterStack object.

See Also

NeighbRasterStack-class, allowNeighb, raster::focal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Plum Island Ecosystems

## observed data
obs <- ObsLulcRasterStack(x=pie,
                    pattern="lu",
                    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=obs[[1]],
                 categories=c(1,2,3),
                 weights=list(w1,w2,w3))

## update nb2 for 1991
nb2 <- NeighbRasterStack(x=obs[[2]],
                  neighb=nb1)

## plot neighbourhood map for forest
plot(nb2[[1]])

lulcc documentation built on May 1, 2019, 7:05 p.m.