as.data.frame.ExpVarRasterList {lulcc} | R Documentation |
Coerce objects to data.frame
Description
This function extracts data from all raster objects in
ObsLulcRasterStack
or ExpVarRasterList
objects
for a specified timestep.
Usage
## S3 method for class 'ExpVarRasterList'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t = 0, ...)
## S3 method for class 'ObsLulcRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t = 0, ...)
## S4 method for signature 'ExpVarRasterList'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t = 0, ...)
## S4 method for signature 'ObsLulcRasterStack'
as.data.frame(x, row.names = NULL,
optional = FALSE, cells, t = 0, ...)
Arguments
x |
an ExpVarRasterList or ObsLulcRasterStack 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) |
Details
If x is an ObsLulcRasterStack object the raster corresponding to t is first
transformed to a RasterBrick with a boolean layer for each class with
raster::layerize
.
Value
A data.frame.
See Also
as.data.frame
, ObsLulcRasterStack
,
ExpVarRasterList
, partition
Examples
## Not run:
## Plum Island Ecosystems
## observed maps
obs <- ObsLulcRasterStack(x=pie,
pattern="lu",
categories=c(1,2,3),
labels=c("Forest","Built","Other"),
t=c(0,6,14))
## explanatory variables
ef <- ExpVarRasterList(x=pie, pattern="ef")
## separate data into training and testing partitions
part <- partition(x=obs[[1]], size=0.1, spatial=TRUE)
df1 <- as.data.frame(x=obs, cells=part[["all"]], t=0)
df2 <- as.data.frame(x=ef, cells=part[["all"]], t=0)
## End(Not run)