[Biodevelopers] Running R from Unix Command Line

Michael Nuhn nuhn at rhrk.uni-kl.de
Fri Aug 4 06:20:57 EDT 2006


>I have a CGI PERL Script that needs to
>invoke the R program on the command line
>of UNIX and send commands to it.

>Can I do this using the normal system command?

Yes.

>Would this work?

Yes.

>If so, how can I specify the commands without clashing
>with the double quotes of perl and that of R?

I had perl create an R script as a file. I used a template and the Perl Template Toolkit to do this. Then, I call R like this:

my $cmd = qq( <R executable> CMD BATCH <R script> );
my $errorlevel = system($cmd);

You can check if it worked like this:

if ($errorlevel) {

    # handle errors

}

Regards,
Michael.

--
-----------------------------------------------------------
Dipl.-Inform. Michael Nuhn
Bioinformatik
Zentrum für Nanostrukturtechnologie und
Molekularbiologische Technologie

+49 (0)631 - 205 4334
nuhn at rhrk.uni-kl.de
http://www.nuhn.net
-----------------------------------------------------------

  ----- Original Message ----- 
  From: Shalini Sridhar 
  To: biodevelopers at bioinformatics.org 
  Sent: Thursday, August 03, 2006 12:41 PM
  Subject: [Biodevelopers] Running R from Unix Command Line


  Hello all,

  If someone can please throw a light on this I would be eternally greatful :

  I have a CGI PERL Script that needs to invoke the R program on the command line of UNIX and send commands to it.

  Can I do this using the normal system command? Would this work? If so, how can I specify the commands without clashing with the double quotes of perl and that of R?

  If not, could someone please suggest an alternative to this ?

  Thanks

  Shalini


   






More information about the Biodevelopers mailing list