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

From: Erik Iverson <eriki_at_ccbr.umn.edu>
Date: Fri, 18 Jun 2010 16:04:02 -0500

Someone with more Windows and/or Perl experience will be of more use, but guessing here:

  1. Try calling system with a program that echoes the path, perhaps the system command is not using the same path variable as you think.
  2. specify the full path to R (using proper escaping of backslashes and/or spaces as necessary), and see if that helps at all.

Barry Hall wrote:
> 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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 Jun 2010 - 21:10:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 21:10:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive