subset-methods: Subset objects

Description Usage Arguments Value Examples

Description

Extract a subset of objects from container classes such as ExpVarRasterStack, PredictiveModelList, PredictionList and PerformanceList.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'PredictiveModelList'
subset(x, subset, drop = FALSE, ...)

## S4 method for signature 'PerformanceList'
subset(x, subset, ...)

## S4 method for signature 'PredictionList'
subset(x, subset, ...)

Arguments

x

an object of class ExpVarRasterStack, PredictiveModelList, PredictionList or PerformanceList

subset

integer or character indicating the objects to be extracted

drop

logical

...

additional arguments (none)

Value

Subsetted object, possibly simplified

Examples

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

lu <- DiscreteLulcRasterStack(x=stack(sibuyan$maps[1:2]),
                              categories=c(1,2,3,4,5),
                              labels=c("forest","coconut","grass","rice","other"),
                              t=c(0,14))


summary(lu)
lu <- subset(lu, subset=names(lu)[1])
summary(lu)

## load explanatory variables
idx <- data.frame(var=paste("ef_", formatC(1:13, width=3, flag=0)),
                  yr=rep(0,13),
                  dynamic=rep(FALSE,13))

ef <- ExpVarRasterStack(x=stack(sibuyan$maps[3:15]), index=idx)

summary(ef)
ef <- subset(ef, subset=1:5)
summary(ef)

simonmoulds/lulcc2 documentation built on Dec. 23, 2021, 2:24 a.m.