Using stack() to extract every Nth band of the input files
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