[R] tapply

From: Weiwei Shi <helprhelp_at_gmail.com>
Date: Tue 21 Jun 2005 - 09:15:46 EST


hi,
i have another question on tapply:
i have a dataset z like this:

5540 389100307391      2600
5541 389100307391      2600
5542 389100307391      2600
5543 389100307391      2600
5544 389100307391      2600
5546 381300302513        NA
5547 387000307470        NA
5548 387000307470        NA
5549 387000307470        NA
5550 387000307470        NA
5551 387000307470        NA
5552 387000307470        NA

I want to sum the column 3 by column 2.
I removed NA by calling:
tapply(z[[3]], z[[2]], sum, na.rm=T)
but it does not work.

then, i used
z1<-z[!is.na(z[[3]],]
and repeat
still doesn't work.

please help.

-- 
Weiwei Shi, Ph.D


"Did you always know?"
"No, I did not. But I believed..."
---Matrix III ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Jun 21 09:20:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:54 EST