Description Usage Arguments Details Value See Also Examples
This function extracts data from all raster objects in
LulcRasterStack
or ExpVarRasterStack
objects
for a specified timestep.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## S3 method for class 'ExpVarRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t, ...)
## S3 method for class 'DiscreteLulcRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t, ...)
## S3 method for class 'ContinuousLulcRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t, ...)
## S4 method for signature 'ExpVarRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t, ...)
## S4 method for signature 'DiscreteLulcRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t, ...)
## S4 method for signature 'ContinuousLulcRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t, ...)
|
x |
an ExpVarRasterStack or LulcRasterStack object |
row.names |
NULL or a character vector giving the row.names for the data.frame. Missing values are not allowed |
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional |
cells |
index of cells to be extracted, which may be a
|
t |
numeric indicating the time under consideration |
... |
additional arguments (none) |
If x is a DiscreteLulcRasterStack object the raster corresponding to t is
first transformed to a RasterBrick with a boolean layer for each class with
raster::layerize
.
A data.frame.
as.data.frame
, LulcRasterStack
,
ExpVarRasterStack
, partition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run:
## Plum Island Ecosystems
## load observed land use maps
lu <- DiscreteLulcRasterStack(x=stack(pie[1:3]),
categories=c(1,2,3),
labels=c("Forest","Built","Other"),
t=c(0,6,14))
## explanatory variables
idx <- data.frame(var=c("ef_001","ef_002","ef_003"),
yr=c(0,0,0),
dynamic=c(FALSE,FALSE,FALSE))
ef <- ExpVarRasterStack(x=stack(pie[4:6]), index=idx)
## separate data into training and testing partitions
part <- partition(x=lu[[1]], size=0.1, spatial=TRUE)
df1 <- as.data.frame(x=lu, cells=part[["all"]], t=0)
df2 <- as.data.frame(x=ef, cells=part[["all"]], t=0)
df <- cbind(df1,df2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.