data(carw)
# Convert data frame to a list of rasters
rl <- lapply(carw.data$raster.data, function(x) {
m <- matrix(x, nrow=carw.data$dim[1], ncol=carw.data$dim[2],
byrow=TRUE)
r <- raster(m)
extent(r) <- carw.data$ext
r
})
# Stack and name them
rs <- stack(rl[[1]], rl[[2]], rl[[3]], rl[[4]], rl[[5]], rl[[6]])
names(rs) <- names(carw.data$raster.data)
plot(rs)
Run the code above in your browser using DataLab