Dear Gianni, I think you want this:
tapply(areaFe$K <= fer.conc.max, areaFe$ID, sum, na.rm=TRUE) E.g.: ID <- rep(1:10, each=10) K <- runif(100) areaFe <- as.data.frame(cbind(ID, K)) fer.conc.max <- 0.5 tapply(areaFe$K <= fer.conc.max, areaFe$ID, sum, na.rm=TRUE) Robert On Fri, Mar 13, 2009 at 9:58 AM, gianni lavaredo <[email protected]> wrote: > dear User > > I'm quite new to R and trying to learn the basic and sorry for the email. I > don't wish abuse of mail-list. I had read manual and Help online about > tapply (...). I have a data frame and I need "count" the Fe value with sum > for every ID sample area > > fer.conc.max <- tapply(areaFe$K, areaFe$ID, max, na.rm=TRUE) > > I need to count the Fe area with Fe$K <= fer.conc.max > > # give me the summatory and not the count > fer.conc.max <- tapply(areaFe$K, areaFe$ID, sum, na.rm=TRUE) > > I tried sever combination that I found in mail-list archive but alway I have > a error message > > thanks Gianni > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
