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

2012-05-12 Thread Thiago Veloso
  Robert,   Thanks for your input. Your suggestion is more suitable to my case, but it takes almost one hour to sum a stack containing 46 satellite images. Please see below: > sclass       : RasterStack dimensions  : 5568, 8289, 46153152, 46  (nrow, > ncol, ncell, nlayers)resolution  : 0.00898,

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