[R] Help using system() command to execute Perl script through MSDOS

pdbarry pdbarry at alaska.edu
Thu Mar 7 03:52:11 CET 2013


I am working on creating a program for some simulations I need to do and I
want to execute a Perl script that I wrote  using the system() command in R.
I have spent a couple days trying to figure this out and it appears that my
problem occurs when sending the perl script file path through R to MSDOS. I
have tried using double backslashes, quotations, etc. Moving my files to the
root directory with no folders with spaces seems to make the problem go
away. 

So here is the code:
system(paste("perl",FP.chmod,FP.baseline.in,FP.baseline.out))
 
where perl is the command to use the perl script
FP.chmod is the extenstion to the perl file
       "C:/Documents and Settings/Pato/Desktop/Mikes R package/chmod700.pl"
        created using FP.chmod<- file.path(wd,'chmod700.pl') #wd is the
working directory
FP.baseline.in is the input file extension
        "C:/Documents and Settings/Pato/Desktop/Mikes R
package/Baseline2c.bse"
FP.baseline.out is the output to make from the perl script.

If I look at it pasted together it looks like it would work: 
"perl C:/Documents and Settings/Pato/Desktop/Mikes R package/chmod700.pl
C:/Documents and Settings/Pato/Desktop/Mikes R package/Baseline2c.bse
C:/Documents and Settings/Pato/Desktop/Mikes R package/Baseline2d.bse

If I change the location of the files so that they are directly under the
root directory it runs without a hitch. I greatly appreciate any help that
can be offered. 
Pat











--
View this message in context: http://r.789695.n4.nabble.com/Help-using-system-command-to-execute-Perl-script-through-MSDOS-tp4660559.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list