[R] How to debug R program?

tfjbl at mail.uas.alaska.edu tfjbl at mail.uas.alaska.edu
Fri Dec 29 15:39:26 CET 2006


On Loops:
The "apply" coomands are better, faster than loops. If there are lots 
of loops or nested loops then you should be able to replace some of the 
loops with an apply command. If you have nested loops I'd recommend 
replacing loops on the inside first.
R  seems better designed using the apply commands.
It seems to be optimized for memory usage.

I found this especially true when I was doing numerical analysis and/or 
boot strap types of things.

Quotes from help:
Description:

     Returns a vector or array or list of values obtained by applying a
     function to margins of an array.





good luck



>       I wrote a R program which has loops. When I run the program, it 
> crashed. I would like to identify in which loop the pragram crashed, 
how 
> can I debug ?  I'm new to R, could somebody please give me a general 
idea 
> about debugging in R.(I'm a C/C++ programmer and have general 
knowledge 
> about program debugging.)
>      Thank you!
> 
> Best,



More information about the R-help mailing list