Hi, I've already asked this question, but unfortunately I've combined it with another question. So it was ignored in almost all cases. Thanks to those who have already given some hints. Here again: 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)? If so, can you please point me to the documentation on the Web or in literature where this is decribed? Do you have some trivial demo Perl script (or C/C++ program) that uses this technique, f.e. calls an R method like "mean" or "standard deviation"? Any help is appreciated very much! Regards Bernhard _________________ Dr. Bernhard Bals Dollmannstr. 6 D-81541 M?nchen +49-89-62509585 bbals at t-online.de
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
Bernhard Bals wrote:> Hi, > > I've already asked this question, but unfortunately I've combined it > with another question. So it was ignored in almost all cases. Thanks to > those who have already given some hints. > > Here again: > > 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)? > If so, can you please point me to the documentation on the Web or in > literature where this is decribed? > > Do you have some trivial demo Perl script (or C/C++ program) that uses > this technique, f.e. calls an R method like "mean" or "standard deviation"? >Haven't used it myself, so I don't know how well it works, but this one might do what you want... http://www.omegahat.org/RSPerl/index.html Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 jasont at indigoindustrial.co.nz