[R] extracting from data frame multiple times

From: Ido M. Tamir <tamir_at_imp.univie.ac.at>
Date: Fri 14 Oct 2005 - 23:33:05 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 14 23:35:41 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:45 EST