[R] Calling functions of R from Perl?

Dirk Eddelbuettel edd at debian.org
Thu Sep 4 01:13:37 CEST 2003


On Wed, Sep 03, 2003 at 11:13:30PM +0200, Bernhard Bals wrote:
> I don't want to use R interactively (issue commands after the prompt > 
> ..), but use some functionality of R from inside a Perl script.
> 
> Can I use methods of R from a Perl script: Is there an interface from
> Perl (or at least from C/C++) to R (f.e. invoke R functions from Perl,
> C, C++ or some other language)?

Sure. You can always use Perl to 'print' commands into a pipe to R. Or even
write them to a file, and then have Perl's backtick or system command
execute the file via R's batch mode.

There is a much higher-end interface available at www.omegahat.org, but it
sounds like you want something simple.

> If so, can you please point me to the documentation on the Web or in
> literature where this is decribed?

Google is your friend -- the 'call R from perl' query finds a total of
353,000 documents, including the aforementioned omegahat.org code as well as
prior discussions on this list.

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=call+R+from+perl&btnG=Google+Search

Dirk


-- 
Those are my principles, and if you don't like them... well, I have others.
                                                -- Groucho Marx




More information about the R-help mailing list