Calling software modules (Java, Perl, etc.) from R

Posted by harshsinghal on Stack Overflow See other posts from Stack Overflow or by harshsinghal
Published on 2010-05-22T20:37:30Z Indexed on 2010/05/22 20:40 UTC
Read the original article Hit count: 227

Filed under:

I've recently started using R for Natural Language Processing tasks and find that a lot of applications are available in Java and Perl (for my purposes).

For example: A few perl modules are available to find distance measures between words by querying Wordnet. I am aware of the R Wordnet package, but it does not perform the tasks that these CPAN modules do. Many Java packages for NLP are out there, which I'd like to use from within R.

I know of rJava, RSPerl, the simple system command amongst others, but I'd like more examples of how I could make calls to Java and Perl applications from R.

Recently I tried capturing console output from a perl script.

cat( 'print "Hello World\n";',file="hello.pl" )

system(command="c:\Perl64\bin\perl hello.pl")

system(command=paste(Sys.getenv("COMSPEC"),"/c","C:\Perl64\bin\perl hello.pl"))

None of the above system commands showed 'Hello World' on the R console. I've used "system" before to run perl scripts to perform tasks without wanting to capture console output.

Any hints and redirection to other more extensive sources of information would be highly appreciated.

Thank you

© Stack Overflow or respective owner

Related posts about r