Re: [R] Summarize by two or more attributes

2011-05-17 Thread ROLL Josh F
Subject: Re: [R] Summarize by two or more attributes On May 17, 2011, at 2:55 PM, ROLL Josh F wrote: > Marc, > How could I also apply the spline function to each of the 'columns' found in > the result from > > tapply(Df$Rate,list(Df$Bin,Df$Type),sum) > > ?? S

Re: [R] Summarize by two or more attributes

2011-05-17 Thread Marc Schwartz
On May 17, 2011, at 2:55 PM, ROLL Josh F wrote: > Marc, > How could I also apply the spline function to each of the 'columns' found in > the result from > > tapply(Df$Rate,list(Df$Bin,Df$Type),sum) > > ?? Something along the lines of the following: apply(tapply(Df$Rate,list(Df$Bin,Df$

Re: [R] Summarize by two or more attributes

2011-05-17 Thread ROLL Josh F
Cc: r-help@r-project.org Subject: Re: [R] Summarize by two or more attributes On May 17, 2011, at 12:53 PM, LCOG1 wrote: > I will hit my own ball on this one > > > tapply(Df$Rate,list(Df$Bin,Df$Type),sum) > Ahayou had mentioned creating a new column in your initial post,

Re: [R] Summarize by two or more attributes

2011-05-17 Thread Marc Schwartz
On May 17, 2011, at 12:53 PM, LCOG1 wrote: > I will hit my own ball on this one > > > tapply(Df$Rate,list(Df$Bin,Df$Type),sum) > Ahayou had mentioned creating a new column in your initial post, presumably added to 'Df', as opposed to creating a new independent matrix of the results. You

Re: [R] Summarize by two or more attributes

2011-05-17 Thread LCOG1
I will hit my own ball on this one tapply(Df$Rate,list(Df$Bin,Df$Type),sum) -- View this message in context: http://r.789695.n4.nabble.com/Summarize-by-two-or-more-attributes-tp3529825p3530034.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Summarize by two or more attributes

2011-05-17 Thread Marc Schwartz
On May 17, 2011, at 11:48 AM, LCOG1 wrote: > 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.fram

Re: [R] Summarize by two or more attributes

2011-05-17 Thread Felipe Carrillo
dlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx - Original Message > From: LCOG1 > To: r-help@r-project.org > Sent: Tue, May 17, 2011 9:48:36 AM > Subject: [R] Summarize by two or more attributes > > Okay everyone heres a likely softball for someon

Re: [R] Summarize by two or more attributes

2011-05-17 Thread Abhijit Dasgupta
One possibility is: library(doBy) summaryBy(Rate~Source+Bin, data=Df, FUN=sum) On 5/17/2011 12:48 PM, LCOG1 wrote: > 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))

[R] Summarize by two or more attributes

2011-05-17 Thread LCOG1
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 th