[R-sig-Geo] Using stack() to extract every Nth band of the input files
Jonathan Greenberg
greenberg at ucdavis.edu
Wed Sep 7 20:01:22 CEST 2011
R-sig-geo'ers:
I'd like to make a stack from a set of 5-band images. Using
stack(myfilenames,bands=3) doesn't appear to do it (I'm getting all
bands of all my input files). Is it better to do something like:
my_rasters=sapply(myfilenames,function(x) { raster(x,band=3) },simplify=FALSE)
my_stack=stack(my_rasters)
... or is there an easier way to do this?
Thanks!
--j
More information about the R-sig-Geo
mailing list