I'm looking for an advice on how to integrate between perl and R (mostly in the direction of querying R or running R-like functions from within Perl).

Too often I find myself writing in Perl wishing I could now switch to R. What I usually end up doing is to write an R script that does what I like, then tell my Perl script to write down the data to a file and call the R script with this input file (simple system). The R scripts parses its input file, does some R magic and writes down the results into a file. The perl script then reads this new file, parses it and continues... not fun at all: a lot of parsing overhead, always need to keep the two in sync when changing anything, etc..

I've done some searching here and ran into some old posts mentioning RSPerl http://www.omegahat.org/RSPerl/index.html but it seems to have been last updated more than 3 years ago. I wonder if this is indeed the right choice, whether there any alternatives, and more generally - what do you commonly do when you need R?

Thanks!


In reply to Perl-R integration by daverave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.