[R] How to speed up R code?

From: Martin Lam <tmlammail_at_yahoo.com>
Date: Tue 18 Oct 2005 - 22:21:58 EST


Hi,

I have written a piece of code, which is a variant of the random forest (rf) package algorithm, entirely in R. I know that some of the code in the rf package is written in c or c++. The problem is that the execution of my code in R takes a lot of time. To give you an example, the building and testing of data set with 20,000 instances using the random forest function from the rf package takes a few minutes while 'my' random forest's execution time is around 5 hours. So, I wonder if there are some ways to speed up the execution time.

I've read in a similar post that using matrix instead of data.frame would actually speed up the R code. The format of my read-in data set is a "list", would the data set in matrix format (using as.matrix) be better?

Thanks in advance,

Martin



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 Tue Oct 18 22:29:32 2005

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