Hi Monks,

I am interested in calling R script from perl. I am doing it because R takes a huge amount of time in reading the file and I have 500 output files (700 kbs each). I need to do matrix operations on it (thats why I am using R as its very fast in doing the same as it contains many functions :)) on unix platform. I am getting the output file from the perl script. I need to extend the script by calling the R script and passing array (which contains the contents of the file ) as the argument. Can you please help me with the same ?

Glimpse of my code

my $filename = 'file1.txt'; open my $posFile, $filename or die $!; open my $OUTFILE, '>', 'file2.txt'; @scoreIndividuals = &score( \*$file1,\*$file2); close($posFile); close($OUTFILE); #### Need to pass the contents of the file (as an array) to #### R script which does only operation on the contents #### (and R sc +ript does not read the file) exit; sub score{ ### Calculates score and writes on the file. }

In reply to Calling R script from Perl by snape

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.