views:

982

answers:

2

I'm wondering about the best way to deploy R. Matlab has the "matlab compiler" (MCR). There has been discussion about something similar in the past for R that would compile R into C or C++. Does anyone have any experience with the R to C Compiler (RCC) that was developed by John Garvin at Rice?

I've looked into it, and it seems to be the only project that worked on compiling R code into executable code. And as far as I can tell, it isn't still being used.

[Edit 1:]: To be clear, I know that there are C and C++ (and Java, Python, etc.) interfaces to R (rJava, rcpp, Rpy, etc.). I'm wondering about specific ways to compile and deploy R code without installing R in advance.

[Edit 2:]: John Mellor-Crummey tells me that they're still working on RCC and hope to make it available in 4 months or so (at the earliest). I'll update this further if I find anything else out.

A: 

I haven't used Garvin's package and don't know what is possible along those lines. However:

Typically people just write computationally intensive functions directly in C/C++/Fortran, after profiling to find the bottlenecks. See the RCpp interface or Calling C functions from R using .C and .Call for examples. The Scythe Statistical Library is also very nice for R users since the syntax/function names are similar.

Tristan
Thanks, those are good links. I'm particularly focusing on the deployment process though, less than the performance issue.
Shane
+4  A: 

I had forgotten about the Rice project, it has been a while. I think the operational term here is stated at the top of the project page: Last Updated 3/8/06.

And we all know R changes a lot. So I have only the standard few pointers for you:

  • Luke Tierney, who not only knows a lot about R internals but equally about byte compilers, has been working on such a project. Nothing ready yet, and it would still work in conjunction with the standard R engine
  • Stephen Milborrow has the Ra extension to R that works with his just-in-time compiler package jit
  • my Introduction to High-Performance Computing with R tutorials (most recent tutorial slides from UseR! 2009) covers the profiling, compiling extentions, parallel computing with R, ... part, including Rcpp and and a bit about RInside.

In short: there is no way have what you desire specific ways to compile and deploy R code without installing R in advance. Sorry.

Dirk Eddelbuettel
Thanks Dirk! Haven't checked out Luke's homepage recently. Your High-Performance Computing paper/tutorial is fantastic. I took the last updated date as meaning exactly what you say, but just wanted to check. :)
Shane