Re: [R] Improving performance of split-apply problem

2012-02-24 Thread Martin
Thank you!! Using lm.fit did the trick. 2012/2/23 R. Michael Weylandt > It looks like what you are doing is reasonably efficient: I do think > there's a residuals element to the object returned by lm() so you > could just call that directly (which will be just a little more > efficient). > > The

Re: [R] Improving performance of split-apply problem

2012-02-23 Thread R. Michael Weylandt
It looks like what you are doing is reasonably efficient: I do think there's a residuals element to the object returned by lm() so you could just call that directly (which will be just a little more efficient). The bulk of the time is probably being taken up in the lm() call, which has alot of ove

[R] Improving performance of split-apply problem

2012-02-22 Thread Martin
Hello, I'm very new to R so my apologies if I'm making an obvious mistake. I have a data frame with ~170k rows and 14 numeric variables. The first 2 of those variables (let's call them group1 and group2) are used to define groups: each unique pair of (group1,group2) is a group. There are roughly 5