Re: [R-sig-Geo] Antw: Error when using rowSums along with a RasterStack object

2012-05-12 Thread Thiago Veloso
2.15.0).   As processing my entire data involves performing this operation at least 30 times, is there a way to optimize the process?   All the best,  Thiago. --- On Sat, 12/5/12, Robert J. Hijmans wrote: From: Robert J. Hijmans Subject: Re: [R-sig-Geo] Antw: Error when using rowSums along with a Rast

Re: [R-sig-Geo] Antw: Error when using rowSums along with a RasterStack object

2012-05-12 Thread Robert J. Hijmans
You can also do sos <- sum(s, na.rm=FALSE) Best, Robert On Sat, May 12, 2012 at 2:26 AM, Matteo Mattiuzzi < matteo.mattiu...@boku.ac.at> wrote: > Dear Thiago, > > is this what you need? > > library(raster) > r <- raster() > r[]<-1:ncell(r) > r2 <- raster() > r2[]<-ncell(r):1 > r <-brick(

[R-sig-Geo] Antw: Error when using rowSums along with a RasterStack object

2012-05-12 Thread Matteo Mattiuzzi
Dear Thiago, is this what you need? library(raster) r <- raster() r[]<-1:ncell(r) r2 <- raster() r2[]<-ncell(r):1 r <-brick(r,r2) plot(r) sos <- calc(r,sum) x11() plot(sos) Matteo sos <- calc(r,sum) plot(sos) >>> Thiago Veloso 11.05.12 23.29 Uhr >>> Dear R-colleagues, I am trying t