[R] Problem calling R from within perl script on Windows

Barry Hall barryhall at zeninternet.com
Fri Jun 18 21:11:53 CEST 2010


I need to call R from within a Perl script.  I do so using a system call like
this:
@args = ('R --vanilla --quiet --file=Rblock'); 
system(@args) == 0 or die "system @args failed: $!";

The script works perfectly when run in Mac OSX or Linux.  In Windows XP it
fails with the message " 'R' is not recognized as an internal or external
command, operable program or batch file".

To ensure that R was properly installed and that the environment variable
"path" was correctly set, I executed the same command (R --vanilla --quiet
--file=Rblock) from the command line and it worked perfectly; i.e. R ran
with the expected behavior.

Similar system calls to other external programs, e.g.
@args = ('Notepad'); 
system(@args) == 0 or die "system @args failed: $!";
work perfectly.

Is there any obvious reason that this particular call works from the command
line but not from within a perl script?

Thanks for any assistance
-- 
View this message in context: http://r.789695.n4.nabble.com/Problem-calling-R-from-within-perl-script-on-Windows-tp2260646p2260646.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list