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) ?? -----Original Message----- From: Marc Schwartz [mailto:marc_schwa...@me.com] Sent: Tuesday, May 17, 2011 12:42 PM To: 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) > Aha....you 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. Your output above creates a 5 x 2 matrix of the resultant sums, one column per 'Type' and one row for each 'Bin'. The use of ave(), now based upon your above: ave(Df$Rate, list(Df$Bin, Df$Type), FUN = sum) would yield a vector of length 20, which could then be added to the original 'Df' as a new column. The vector would be ordered in such a fashion as to match up with the original rows, based upon Bin and Type. I am tempted to quote a famous line from Cool Hand Luke, but I'll leave that for now... :-) Regards, Marc Schwartz ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.