Skip to content

r and c++ (Duncan Murdoch)

1 message · Pedro Silva

#
------------------------------

Message: 22
Date: Thu, 12 Feb 2009 09:38:10 -0600
From: Dirk Eddelbuettel <edd at debian.org>
Subject: Re: [R] r and c++
To: JC <new2stats at googlemail.com>
Cc: r-help at r-project.org
Message-ID: <18836.16994.244794.92064 at ron.nulle.part>
Content-Type: text/plain; charset=us-ascii


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