Re: [Rd] Subsetting a data frame vs. subsetting the columns

2011-12-28 Thread Hadley Wickham
Ah, thanks for the pointers! Hadley On Wed, Dec 28, 2011 at 10:14 AM, Simon Urbanek wrote: > Hadley, > > there was a whole discussion about subsetting and subassigning data frames > (and general efficiency issues) some time ago (I can't find it in a hurry but > others might) -- just look at the

Re: [Rd] Subsetting a data frame vs. subsetting the columns

2011-12-28 Thread Joshua Wiley
On Wed, Dec 28, 2011 at 8:14 AM, Simon Urbanek wrote: > Hadley, > > there was a whole discussion about subsetting and subassigning data frames > (and general efficiency issues) some time ago (I can't find it in a hurry but > others might) Yep, a rather lengthy discussion at that http://r.789695

Re: [Rd] Subsetting a data frame vs. subsetting the columns

2011-12-28 Thread Simon Urbanek
Hadley, there was a whole discussion about subsetting and subassigning data frames (and general efficiency issues) some time ago (I can't find it in a hurry but others might) -- just look at the `[.data.frame` code to see why it's so slow. It would need to be pushed into C code to allow certain

[Rd] Subsetting a data frame vs. subsetting the columns

2011-12-28 Thread Hadley Wickham
Hi all, There seems to be rather a large speed disparity in subsetting when working with a whole data frame vs. working with just columns individually: df <- as.data.frame(replicate(10, runif(1e5))) ord <- order(df[[1]]) system.time(df[ord, ]) # user system elapsed # 0.043 0.007 0.059 sy