Skip to content
Prev 5268 / 29559 Next

Help to count in apply(...)

I see, I did not understand that. This is a quick fix, please check if
it is OK. Using which.max might be more elegant.

ID <- rep(1:10, each=10)
K <- runif(100)
areaFe <- as.data.frame(cbind(ID, K))
fer.conc.max <- tapply(areaFe$K, areaFe$ID, max, na.rm=TRUE)
fermax <- rep (fer.conc.max, each=10)
tapply(areaFe$K > 0.9 * fermax, areaFe$ID, sum, na.rm=TRUE)

Robert

On Fri, Mar 13, 2009 at 5:02 PM, gianni lavaredo
<gianni.lavaredo at gmail.com> wrote: