[R-sig-Geo] Getting vector index (i.e. layer number) for each cell in raster brick

2011-12-01 Thread Lyndon Estes
Dear List, I was hoping to get some advice on the best way to solve the following problem given two raster bricks. Given two bricks: r.list <- lapply(1:20, function(x) { r <- raster(xmn = 25, xmx = 32, ymn = -34, ymx = -27) res(r) <- 0.1 r[] <- runif(ncell(r)) return(r) }) rs1 <- stack(lappl

Re: [R-sig-Geo] Getting vector index (i.e. layer number) for each cell in raster brick

2011-12-01 Thread Robert J. Hijmans
Hi Lyndon, I think there is a function for that: x <- stackSelect(rb2, ind.r) I.e., for each cell, use the value in ind.r to select the layer in rb2 from which to take the value for the output layer. Best, Robert On Thu, Dec 1, 2011 at 5:55 PM, Lyndon Estes wrote: > Dear List, > > I was ho

Re: [R-sig-Geo] Getting vector index (i.e. layer number) for each cell in raster brick

2011-12-02 Thread Saman Monfared
Dear all Can I use residual cokriging for some variables?? If yes,how?? On 12/2/11, Robert J. Hijmans wrote: > Hi Lyndon, > > I think there is a function for that: > > x <- stackSelect(rb2, ind.r) > > I.e., for each cell, use the value in ind.r to select the layer in rb2 from > which to take the

Re: [R-sig-Geo] Getting vector index (i.e. layer number) for each cell in raster brick

2011-12-02 Thread Lyndon Estes
Hi Robert, Very many thanks, and I see the two hours I spent on that last night would have been more profitably applied in the help files. Cheers, Lyndon On Fri, Dec 2, 2011 at 12:10 AM, Robert J. Hijmans wrote: > Hi Lyndon, > > I think there is a function for that: > > x <- stackSelect(rb2, in