[R] extracting from data frame multiple times

Ido M. Tamir tamir at imp.univie.ac.at
Fri Oct 14 15:33:05 CEST 2005


Hello,
i am trying to subset a dataframe multiple times:
something like:

stats <- by(df, list(items), ttestData)

ttestData <- function(df){
    t.test( df[,c(2,3,4), df[,c(5,6,7)]
}

While this works for small data, it is to slow for my
actual data: 500000 rows dataframe with 
about 135000 different indices, subsetting the
dataframe into chunks of 5 on average.

Do you have any suggestions how I could speed this up?

I tried changing to call by reference with
the package ref, but by does not like that.

Thank you very much in advance
Ido Tamir




More information about the R-help mailing list