Skip to content
Prev 42150 / 63458 Next

Subsetting a data frame vs. subsetting the columns

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 optimizations, but it's a quite complex code so I don't think there were volunteers. So the advice is don't do it ;). Treating DFs as lists is always faster since you get to the fast internal code.

Cheers,
S
On Dec 28, 2011, at 10:37 AM, Hadley Wickham wrote: