The R Prolog Programming Interface¶
This library enables the communication with an R process started as a shared library. It is the result of the efforts of two research groups that have worked in parallel. The syntactic emphasis on a minimalistic interface.
In the doc/ directory of the distribution there is user's guide, a published paper and html documentation from PlDoc (doc/html/real.html). There is large number of examples in examples/for_real.pl
.
A single predicate (<-/2,<-/1) channels the bulk of the interactions. In addition to using R as a shared library, real uses the c-interfaces of SWI/Yap and R to pass objects in both directions. The usual mode of operation is to load Prolog values on to R variables and then call R functions on these values. The return value of the called function can be either placed on R variable or passed back to Prolog. It has been tested extensively on current SWI and YAP on Linux machines but it should also compile and work on MS operating systems and Macs.
The main modes for utilising the interface are ```
<- +Rexpr <- +Rvar
` Print Rvar or evaluate expression Rexpr in R
````
+Rvar <- +PLdata
+Rexpr <- +PLdata
-PLvar <- +Rvar
-PLvar <- +Rexpr
+Rexpr1 <- +Rexpr2
Pass Prolog data to R, pass R data to Prolog or assign an R expression to an assignable R expression.