Re: [Rd] C vs. C++ as learning and development tool for R

From: Vladimir Dergachev <>
Date: Fri 19 Jan 2007 - 18:51:25 GMT

On Friday 19 January 2007 1:29 pm, Gabor Grothendieck wrote:
> > If you decide to use C++ with R you should check out the documentation
> > that comes with the package RcppTemplate, and the sample code that
> > comes with that package. In my experience C++ (or C or FORTRAN) is
> > needed for many compute intensive tasks, and the R framework provides
> > a nice front-end with its extensive collection of visualization and
> > statistical analysis tools.
> Actually I have found the opposite. I have never found C/C++ to be
> necessary. I have always been able to optimize the R code itself to get it
> to run sufficiently fast for my purposes.

The nice thing about being able to use C code is that this provides confidence that however slowly your R script runs right now you will be able to make it faster - no matter what.

On quite a few occasions I have started writing C code and after thinking about how I would structure it realized that I can do the same thing in R and still get 50% of the speed improvement I get from C.

Also, I am not sure whether this is mentioned anywhere, but I found it to be more convenient to use dyn.load directly instead of creating a full-blown R package. This way the edit-compile-test cycle is much more convenient.


                                   Vladimir Dergachev

______________________________________________ mailing list Received on Sat Jan 20 06:43:42 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 19 Jan 2007 - 20:31:16 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.