Discussion: View Thread

  • 1.  Compiling R codes to executable format

    Posted 10-06-2011 16:51

    Hi all,

    As the lone statistician in my company, I often face the need to write templates in Excel or write R functions for my colleagues so that they can do simple statistical analyses on their own.

    However, deploying R codes to colleagues who are not statisticians and/or not quite adept to programming can be challenging.  I am sure most (if not all) of you are familiar with some quirks in using R that are trivial to frequent users but can be daunting to occasional users.

    As a statistical consultant, it would be very helpful if I could deploy these R codes as executable files.  MATLAB has a compiler for MATLAB codes.  Is anyone familiar with compilers for R that could be used to convert R codes to executable files?  The idea is for my colleagues to run R codes without having the need to install R in their computer terminals, just like compiled MATLAB codes.

    Best regards,

    Jason

    -------------------------------------------
    Jason Parcon
    Senior Research Scientist
    Givaudan Flavors Corporation
    -------------------------------------------


  • 2.  RE:Compiling R codes to executable format

    Posted 10-06-2011 16:57

    I don't know of any full compilers (most efforts I have seen have either been very simplistic, or still required most of R to be installed, or both), but one option is the RExcel project (http://rcom.univie.ac.at/download.html) which will install R as an Excel "Add-in".  You can use this to install R on the non-statisticians computer, but they will not see it, only an add-in for Excel.  Then you can send them an excel spreadsheet that will run R in the background to do the computations or graphing.


    -------------------------------------------
    Gregory Snow
    -------------------------------------------





  • 3.  RE:Compiling R codes to executable format

    Posted 10-06-2011 18:11
    I've also looked for such things and I don't think there is any such thing.  Actually, the typical Matlab "compiler" copies the Matlab engine, it just doesn't allow another party to do any programming for it.  Generating independent C (say) requires an expensive add-on, and even then does not support the entire Matlab language.  I.e., running the Matlab-generated "executable" would be like installing Matlab...so it's pretty much equivalent to installing R.

    Besides Gregory's idea (below), R also comes with Tcl/Tk.  With some learning of this toolkit and how R talks to it, you could create a minimal GUI application that would allow someone to load a data file and generate a result.  The user has to start R and launch the script (surely there is a way to just launch the script--anyone?) but then the user experience is easy.

    If you can get any IT and programming support, I think the best avenue is to link R to a web page (it's what my group does).  This way you only have to manage 1 instance of the script running on 1 machine, and the user only needs a web browser.  This requires IT support and some programming, but in the long run I think it's the best option.  You might want to keep that in mind as a goal:  give people scripts, get management buy-in, then ask for help to deploy an intranet site.

    -Jim


    -------------------------------------------
    James Garrett
    Manager, R&D Statistics
    Becton Dickinson
    -------------------------------------------








  • 4.  RE:Compiling R codes to executable format

    Posted 10-07-2011 13:30


    I have done the tcl/tk route as well.  Create a tcl/tk front end for a specific task (I most commonly use the tkexamp tool from the TeachingDemos package, but I could be biased), then install R on the clients computer with my code.

    You can set a specific function to run automatically in a couple different ways see ?Startup in R for the details, but the simplest is to create a function called .First and save the workspace.  Then the next time R is run the .First function automatically runs. 

    -------------------------------------------
    Gregory Snow
    -------------------------------------------