Skip to content

r and c++

3 messages · JC, Duncan Murdoch, Dirk Eddelbuettel

JC
#
Hi all,

is there a way to integrate R language within a c++ programme? That is, 
is there something like an R library I can incorporate in my c++ code?

Thanks,

Javier
#
On 2/12/2009 10:16 AM, JC wrote:
Yes, that's described in the Writing R Extensions manual, in chapter 8, 
"Linking GUIs and other front-ends to R".

Duncan Murdoch
#
Javier,
On 12 February 2009 at 16:16, JC wrote:
| is there a way to integrate R language within a c++ programme? That is, 
| is there something like an R library I can incorporate in my c++ code?

I have two projects on R-Forge.R-Project.org that may be of interest: 

 Rcpp		which makes it easy to pass R objects to and from C++ routines,
 		ie when you are building R packages, and the control resides
 		in the R session; 

 RInside	which provides C++ classes to make embedding R into your C++
 		applications easier, and which uses some of the Rcpp classes 
		for conversion.

RInside may be what you are looking for.  The package is currently somewhat raw
-- no configure logic, and the Makefile has the path that works for me (on
Debian / Ubuntu) but if you know enough about C, C++, R, ... to be tempted by
this you probably also know how to adapt this.  

The code itself is mature.  I had used variants of RInside for quite some
time, and the inner workings are the same as in our well-tested littler
scripting frontend to R.

And yes, I should put up a webpage for RInside as well ...
		
Hth, Dirk