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
<o.roessler@giub.uni-bonn.de>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 combination apply with sum(...)
> is
> not working, since the pure
> apply(object,2,sum) does work.
>
> May you help me want to do here instead?
>
> Thank you very much in forward
>
> Ole
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Sum%28..%29-in-apply%28%29-tp21834429p21834429.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]