Re: [R] Sum(..) in apply()

2009-02-04 Thread Henrique Dallazuanna
Try this: result<- apply(temp,2,function(column)sum((column <=15)&(column > 6)), na.rm=TRUE) On Wed, Feb 4, 2009 at 2:48 PM, ole_roessler wrote: > > Dear, > > I have a set of ascii-grids. For each gridcell I want to count all values > that lie between 15 and 6. > Therefore I combined the ascii-

Re: [R] Sum(..) in apply()

2009-02-04 Thread Uwe Ligges
ole_roessler wrote: Dear, I have a set of ascii-grids. For each gridcell I want to count all values that lie between 15 and 6. Therefore I combined the ascii-grids in an array and used result<- apply(temp,2,sum((temp <=15)&(temp > 6)), na.rm=TRUE) But, this doesn`t work. It seems that the

[R] Sum(..) in apply()

2009-02-04 Thread ole_roessler
Dear, I have a set of ascii-grids. For each gridcell I want to count all values that lie between 15 and 6. Therefore I combined the ascii-grids in an array and used result<- apply(temp,2,sum((temp <=15)&(temp > 6)), na.rm=TRUE) But, this doesn`t work. It seems that the combination apply with