From vdergachev at rcgardis.com  Fri Jan 19 19:51:25 2007
From: vdergachev at rcgardis.com (Vladimir Dergachev)
Date: Fri, 19 Jan 2007 13:51:25 -0500
Subject: [Rd] C vs. C++ as learning and development tool for R
In-Reply-To: <971536df0701191029t714172f1j38b3ed62f43ac311@mail.gmail.com>
References: <836F00680EECD340A96AD34ECFF3B534B4A731@iu-mssg-mbx106.ads.iu.edu>
	<45B10C28.3010402@DecisionSynergy.com>
	<971536df0701191029t714172f1j38b3ed62f43ac311@mail.gmail.com>
Message-ID: <200701191351.25485.vdergachev@rcgardis.com>

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.

                              best

                                   Vladimir Dergachev



[Rd] C vs. C++ as learning and development tool for R
Vladimir Dergachev