Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Calling R script from Perl

by snape (Pilgrim)
on Mar 25, 2010 at 20:31 UTC ( [id://830959]=perlquestion: print w/replies, xml ) Need Help??

snape has asked for the wisdom of the Perl Monks concerning the following question:

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. }

Replies are listed 'Best First'.
Re: Calling R script from Perl
by marto (Cardinal) on Mar 25, 2010 at 20:40 UTC

    Statistics::R maybe? There seems to be a few modules on CPAN which may be of interest.

Re: Calling R script from Perl
by GrandFather (Saint) on Mar 26, 2010 at 00:26 UTC

    Maybe you could use PDL instead of using R?


    True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://830959]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found