[R] How to call R routines in C++`

Dirk Eddelbuettel edd at debian.org
Fri Sep 4 06:08:56 CEST 2009


On 3 September 2009 at 20:41, lehe wrote:
| Hi,
| I have some results generated in my C++ program. I 'd like to call some R
| functions that can test if two sample sets are from different distribution,
| like Kolmogorov-Smirnov and other more sophisticated Tests. I also like to
| draw the histograms of the two sample sets in the same plot using R. As a
| newbie to R, I greatly appreciate any suggestions on how to call R in C/C++
| and recommendations on related R packages!

The general approach is described in the 'R Extensions' manual and sometimes
discussed on the r-devel list.  It is somewhat error-prone.

So have a look at 

	http://dirk.eddelbuettel.com/code/rinside.html

which very much describes your use case.  

The initial build is currently a little too hardcoded (but works out of the
box on Debian / Ubuntu in 32 and 64 bit). I need to add some more autoconf
logic to copy with slighly different directory structures on eg Fedora 64bit.

If you don't want to embed R, then Simon's Rserve is an excellent alternative.

Dirk

-- 
Three out of two people have difficulties with fractions.




More information about the R-help mailing list