[R] Summarize by two or more attributes

LCOG1 jroll at lcog.org
Tue May 17 18:48:36 CEST 2011


Okay everyone heres a likely softball for someone.

Consider the following data frame:

#Create data
x<-rep(c(1,15),10)
y<-rnorm(20)
z<-c(rep("auto",10),rep("bus",10))
a<-rep(c(1,1,2,2,3,3,4,4,5,5),2)
#Create Data frame
Df<-data.frame(Source=x,Rate=y,Bin=a,Type=z)


I want to create a new column the equals the sum of the Rates for each type
(1,15) by Bin.  

A related question:  I have been using R for a while now and usually
manipulate my data in data frames but i know lists are better for R so
perhaps the above should be done using lists.  Feel free to offer
suggestions coming from that angle.  

Thanks guys

JR-



--
View this message in context: http://r.789695.n4.nabble.com/Summarize-by-two-or-more-attributes-tp3529825p3529825.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list