I have a perl script (SFDRv166.pl, available here http://bit.ly/1DGmUTL) that I run successfully from the command line using:
perl SFDRv166.pl -assoc input.txt -SFDR -out test
I now need to run this program as part of an R script, and have tried implementing it as follows:
arg1 <- shQuote("-assoc input.txt")
arg2 <- shQuote("-SFDR")
arg3 <- shQuote("-out test")
system("perl SFDRv166.pl arg1 arg2 arg3")
However, I get an ERROR: cannot find ! message generated I believe because the arguments are not getting passed to the perl script (output says no input or output file specified, and no output is created).
I can see from reading the documentation for system() that arguments with spaces require special handling, which is why I have tried to use shQuote(). Not sure what else may be wrong with my approach?
paste:system(paste("perl","SFDRv166.pl",arg1,arg2,arg3))xls2sepin the gdata package. It calls perl with arguments.