RCL uses CFFI to communicate with the R environment, RCLmath links with libRmath and makes some functions accessible in a much simpler way. The code is available under the MIT license. Note that there is another project working on communication between Common Lisp and R: RCLG.


Download: rcl.tar.gz (older snapshots rcl-150605.tgz, rcl-141102.tgz, rcl-130907.tgz, rcl-130412.tgz, rcl-090715.tgz, rcl-081007.tgz, rcl-070628.tgz, rcl-070316.tgz, rcl-060716.tgz,rcl-060703.tgz,rcl-060623.tgz).

(asdf-install:install "http://common-lisp.net/project/rcl/rcl.tar.gz")


(ql:quickload :rcl)

You can run a basic test suite doing (if you get an error about package UIOP being missing in the first step, try again):

(ql:quickload :rcl-test)
(asdf:test-system :rcl)

It is known to work with R-3.1.2 on Linux, MaxOSX and Windows for multiple lisp implementations: ABCL, CLISP, ClozureCL (1.10 required, a bug in previous versions can result in an infinite loop), CMUCL, ECL, SBCL, AllegroCL, LispWorks (the last two tested only in 32-bits).

In some implementations, you'll need to ensure R_PATH is properly set. In Windows, the PATH variable might have to be modified for DLLs to be found (R.dll depends on others). You might also need to edit the library path in config.lisp; if rcl:*r-lib-loaded* is nil, try (cffi:load-foreign-library *r-lib*) to see what's the problem (see init.lisp).

CL-USER> (in-package :rcl)
R> (r-init)
R> (r "R.Version")
((:|nickname| "Pumpkin Helmet")
 (:|version.string| "R version 3.1.2 (2014-10-31)") (:|language| "R")
 (:|svn rev| "66913") (:|day| "31") (:|month| "10") (:|year| "2014")
 (:|minor| "1.2") (:|major| "3") (:|status| "")
 (:|system| "x86_64, darwin13.4.0") (:|os| "darwin13.4.0") (:|arch| "x86_64")
 (:|platform| "x86_64-apple-darwin13.4.0"))

When decoding an object with attributes, most of this information is ignore. You can set the variable rcl:*debug-attributes* to print information about attributes as they are encountered.