[R] Calculate of data frame

From: Zhang, Fan <fzhang_at_doubleclick.net>
Date: Fri 15 Jul 2005 - 03:02:35 EST


Hello,  

I have a dataframe which I read from a file:  

df <- readtable(myFile);  

The dataframe has 4 columns: "model", "count", "value" and "date" where "model" and "date" are made of charactors and "count" and "value" are numbers. An example is like:
model count value date

A            4            20.8    7/1/2005
A            3            10.2    7/2/2005
B            7            14.2    7/1/2005
B            1            6.2      7/2/2005
A            2            11        7/1/2005
B            9            65.2     7/2/2005
 

Now I want to get the total count and value for each model/date pair, like
model count value date

A            6        31.8        7/1/2005
A            3            10.2    7/2/2005
B            7            14.2    7/1/2005
B            10            67.4      7/2/2005
 

Anyone can tell me how to do this?  

Thanks.  

Fan

        [[alternative HTML version deleted]]



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 Fri Jul 15 03:11:22 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:40 EST