As noted on the Google Open Source Blog last week, R package authors Dirk Eddelbuettel and Romain Francois recently gave a presentation on R at the Googleplex, on various topic related to “bridging” R into other systems. Their 90-minute talk is available for replay on YouTube (as part of the Google TechTalks series), and you can download the slides from Dirk's blog. For the Google audience, I'm sure it prompted many ideas on how to further marry R into analytical systems there.
The first part of the talk is all about how to speed up R by recoding tight loops in C++ and calling them from R via the .Call function. Without help it could be tricky to whip up a C++ function to call from R, but Dirk and Romain have made the process hassle-free by providing the Rcpp package, which provides a high-level mapping between R and C++ object types. Next, they give examples of the inline package by Oleg Skylar et al, which makes it easy to embed C++ code in R functions, and automates the process of compiling and linking the C++ code so you don't have to worry about it. They also discussed their Rinside package, which makes it possible to call R directly from a C++ program (and of course share objects and data via Rcpp). Finally, they gave examples of integrating R with protocol buffers (a widely used mechanism used at Google for serializing data for exchange between different systems) with the RProtoBuf package.
The second part of the talk focused on the various ways possible to build data structures in R: S3 classes, S4 classes and now the new reference classes available in R 2.12. These reference classes (which they call R5 classes) are objects with components which are not copied when the object is copied (they are passed by reference, not by value). There's a detailed overview of reference classes in the “methods” package of the R documentation, under ReferenceClasses. The audience of the talk included John Chambers who designed R (and S's) class systems. He asked the first question during the discussion period, so be sure to listen through to the end.
Open Source at Google: Integrating R with C++: Rcpp, RInside, and RProtobuf