Message-ID: <4989E61E.6070809@statistik.tu-dortmund.de>
Date: 2009-02-04T19:01:50Z
From: Uwe Ligges
Subject: Sum(..) in apply()
In-Reply-To: <21834429.post@talk.nabble.com>
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 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?
You probably want
result <- apply(temp <= 15 & temp > 6, 2, sum, na.rm=TRUE)
Uwe Ligges
> Thank you very much in forward
>
> Ole
>
>
>
>