How to write efficient R code
`S Programming' (see the FAQ) has a whole chapter with case studies. Beware that what is efficient under one version of S is not necessarily so under another, and that applies to R today vs R in 1999 (when those examples were done). However, the general principles are good for all time.
On Tue, 17 Feb 2004 Lennart.Borgman at astrazeneca.com wrote:
I have been lurking in this list a while and searching in the archives to find out how one learns to write fast R code. One solution seems to be to write part of the code not in R but in C. However after finding a benchmark article (http://www.sciviews.org/other/benchmark.htm) I have been more interested in making the R code itself more efficient. I would like to find more info about this. I have tried to mail the contact person for the benchmark, but I have so recieved no reply. I am not an R programmer (or statistican) so I do not know R well. I am looking for some advice about writing fast R code. What about the different data types for example? Is there some good place to start to look for more info about this?
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595