[R] calling Perl script from R on Windows 7
Greg.Snow at imail.org
Mon May 24 22:34:50 CEST 2010
Try your same system command, but set intern=TRUE in the call and see if that does what you want.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Harsh
> Sent: Saturday, May 22, 2010 2:13 PM
> To: r-help at r-project.org
> Subject: [R] calling Perl script from R on Windows 7
> Hi list,
> I would like to capture the console output of a Perl script by running
> script from R.
> I have tried the following:
> # Create perl script
> cat( 'print "Hello World\n";',file="hello.pl" )
> # Trial 1
> system(command="c:\\Perl64\\bin\\perl hello.pl")
> -I saw no output for the above command. I have used this method before
> run perl scripts that performed tasks, but only now do I want to
> capture the
> perl output from the print command within the perl script
> # Trial 2
> - In the help for 'system' in R, it mentions making the above changes
> if one
> wants to pass a command to the cmd on a windows machine.
> I am using R 2.9.2 on Windows 7.
> I'm doing this since I want to run perl scripts to find distance
> between words (Wordnet Similarity perl modules) and capture the numeric
> result from the perl script execution back into R. I have heard of
> but I would greatly appreciate a solution using system. Writing the
> to a file and then reading the file could be a another option, but I'd
> to learn about capturing console output from perl into R.
> Any suggestions or hints would be appreciated with much gratitude.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help