Interface to R executables.
This library facilitates interaction with the R system for statistical
computing. It assumes an R executable in $PATH or can be given a location
to a functioning R executable (see r_bin/1 and r_open/1 for details on how
R is located). R is ran as a slave with Prolog writing on and reading from
the associated streams. Multiple sessions can be managed simultaneously.
r_session works on current versions of SWI and Yap.
For a number of years r_session was distributed with SWI as library('R').
This library has been superseeded by pack(real), which provides a much faster and robust interface to R by embedding the R dynamic library in Prolog using the foreign library interface. Still, the process based approach can come handy:
Documentation about this pack is in doc/r_session.html and a simple demo is in examples/r_demo.pl.
- It may be easier to install (depending on the platform)
- It can run R on a remote computer that provides more resources
- Multiple R engines may be created and destroyed.
- On some platforms, R cannot open graphical windows when embedded in Prolog.
r_session can be installed from within SWI using its
And then load with:
There are a number of examples in the file examples/r_demo.pl which
also implements a run_all script.
?- edit( pack(r_sessoin/examples/r_demo) ).
Also available in distribution directory doc/
We always welcome comments on use cases. Particularly, applications and publications that use this pack.
We also welcome fixes and bug reports.
For contact details see: contact
To Jan Wielemaker,
SWI-Prolog developer, for including the pack in versions of SWI up to 7.1.28 (as library('R')).