Overview

The RInside package provides C++ classes that make it easier to
embed R in
C++ code -- on either Linux, OS X or Windows.

Embedding R is described first and
foremost in the 'Writing R Extensions' manual in the core R sources. It describes how to embed R --- but it does not make for easy reading
as there are many little details to take care of.

Viewed from another angle, this is one of the standard motivations for
abstraction and embedding (of both the logic and the little
details) in dedicated (C++) classes. Presto -- that is exactly what
RInside does.

Consider this overly complicated 'hello, world' program in four
lines, included as rinside_sample0.cpp in the sources. It provides
an instance of an embedded R interpreter, an assignment and an
evaluation in just a handful of lines:

While this example is contrived, real-world uses are in the (possibly
repeated) calling of data preparation, scrubbing, pre- or post-processing in
the context of a C++ program. So rather than writing the data you may have
out to file, calling R, parsing results back in -- and worse, doing this over
and over -- you can start R once, and pass data structures to it, call
functions you may have preloaded and get condensed results back.

Featured Application: Embedding into Web Apps with Wt

History

RInside owes its basic structure to littler, the
first-ever R scripting front-end by Jeff
Horner and Dirk Eddelbuettel. RInside, just
like littler, owes a lot to the tricks Jeff learned about embedding R via his
Rapache
project. However, RInside is a fresh C++ version of these ideas.

Status

Version 0.2.5 should build, install and run on just about any Linux and OS X
system, and even on Windows machines that have the
Rtools compiled by Duncan Murdoch
as detailed in the
The Windows Toolset
appendix to the R Installation manual. Do not report an
error if you fail to build this with another compiler as this is not
supported. Note that to build the examples on Windows, you need to say
make -f Makefile.win to explicitly selects its Makefile.
RInside works particularly well with the
Rcpp package
for interfacing R and C++ and shown by the examples in the RInside
distribution. In fact, it now depends on it too.

Examples

A total of fifteend complete examples are provided in the directory
examples/standard, as well as three test programs
that triggered earlier bugs. These can serve as simple examples for your own
programs. After installation, just say make in the examples
directory (and say make -f Makefile.win if on that other OS).

Other examples directories show the Qt and Wt examples, use with MPI, use
with the Rcpp extension Armadillo and Eigen as well as using Boost for a
multithreaded application.

All examples are self-contained and fully functional. Just say
make in one of the example subdirectories.

Documentation

The examples/ directory provides some working examples. Auto-generated
html documentation
is available as is the
manual
generated from the help files.