Learn R Programming

rasterList (version 0.5.20)

stack,RasterList-method: Creates a RasterStack-class object from a RasterList-class

Description

The method transforms a RasterList-class into a RasterStack-class in case of the list elements are numeric vectors.

Usage

# S4 method for RasterList
stack(x, ...)

Value

a RasterStack-class object

Arguments

x

a rasterList-class object

...

further arguments for rasterList

See Also

rasterList

Examples

Run this code

f <- system.file("external/test.grd", package="raster")

## Creates a simple generic RasterList

rl <- rasterList(f) 

list <- as.list(as.vector(rl))
list <- lapply(X=list,FUN=function (x) {c(x,x+10,x+15)}) 

rl <- rasterList(rl,list=list,object.name="test")

ss <- stack(rl)

il <- 8331
list[[il]] <- numeric(0)
rla <- rasterList(rl,list=list,object.name="test2")
sa <- stack(rla) 

Run the code above in your browser using DataLab