> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, February 18, 2004 3:36 AM
> To: [EMAIL PROTECTED]
> Subject: [R] How to write efficient R code
>
> 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.

One way to make your codes more efficient is to use "vectorisation" --
vectorise your codes.  I'm not sure where you can find more
information about it, but an example would be to use the apply()
function on a data frame instead using a loop.  Avoid loops if you
can.

Kevin

--------------------------------------------
Ko-Kang Kevin Wang, MSc(Hon)
SLC Stats Workshops Co-ordinator
The University of Auckland
New Zealand

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to