[R-sig-Geo] Extracting a z-subset from a rasterStack object

Robert J. Hijmans r.hijmans at gmail.com
Fri May 28 03:09:18 CEST 2010


Hi Jonathan,

You can do it by accessing the layers slot:

data_sub=stack( data_stack at layers[10:20] )

But I like better what you tried to do, and will implement that.

Robert


On Thu, May 27, 2010 at 3:55 PM, Jonathan Greenberg
<greenberg at ucdavis.edu> wrote:
> I'm thinking I'm missing something obvious -- if I want to make a new
> raster stack which is a subset of another raster stack, how do I go
> about doing this?  Neither of these worked:
>
> data_sub=stack(data_stack,bands=c(10,20))
> data_sub=stack(data_stack,index=c(10,20))
>
> data_stack is a rasterStack of 1500 layers...
>
> Thanks!
>
> --j
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list