[R] system command and Perl confusion

Nathan McIntyre nmcintyre at mac.com
Sat Apr 7 01:47:50 CEST 2012


This reads like a PATH problem. Specify the absolute path to the perl you
want use: /usr/bin/perl or /opt/local/bin/perl. It looks like you already
have Statistics::Descriptive thru MacPorts; you can use
system(paste("/opt/local/bin/perl myscript.pl", ..., sep = " ")). If you
plan on using the Mac OS X version, /usr/bin/perl, use /usr/bin/cpan to
install Statistics::Descriptive first as it appears you don't have that
installed in /System/Library/Perl.

Thanks,
Nathan

>Hello,
>
>I'm having a question related to the system command within R: I try to
>evoke a perl script from within R with something like
>system(paste('perl myscript.pl', some parameters ....,sep=" ")
>
>This works just fine as long as I do not use any additionally installed
>Perl module, as this leads to a
>
>"Can't locate Statistics/Descriptive.pm in @INC ....."
>
>This is most likely due to the fact that there are somehow two Perls on my
>Mac OS X (one must have come through my trials playing with Macports), one
>is the Perl that came with the system.
>
>What I do not get, is that I can run the script from the command line
>without a problem.
>
>How can I make R aware of "the other" @INC?
>
>In the terminal, I find Perl to be in
>/opt/local/bin/Perl
>
>the above module is accordingly in
>/opt/local/lib/perl5/site_perl/5.8.9/Statistics/Descriptive.pm
>
>In contrast, running the Perl script from within R, it tries to find the
>modules in /System/Library/Perl/5.10.0/...
>
>I see that this is not necessarily a pure R question, but as it occurs
>specifically using the R system command I thought there might be someone
>around here who came across similar problems!
>
>Best wishes
>Maxim
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>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.



More information about the R-help mailing list