Database Reference
In-Depth Information
How it works…
The key here is to use the Mathematica keyword Function in order to create the function
and return it. We assigned this to factor-int , and from that point onwards, we can treat the
value as a regular function value.
Setting up R to talk to Clojure
Another major statistical processing environment is R. It's an open source programming
language and environment designed for statistical analysis. It's widely used and has an
active community as well as a huge and growing body of useful add-on packages.
While there's no Clojure-speciic interoperability library, there is one for Java, and we can
use that to pass calls to R and to get results back. In this recipe, we'll set this system up.
Getting ready
We'll need to have R installed. We can download it from http://www.r-project.org/
by following the link to CRAN, picking a mirror, and downloading the correct version of R for
our platform.
You'll also need to have Maven ( http://maven.apache.org/ ) installed in order to build
and install the libraries to access R.
How to do it…
There are two parts to setting up this system. We'll get the R-side working, and then we'll see
what Clojure needs to have in place.
Setting up R
To set up the system, we irst have to conigure R to talk to Clojure:
1.
Once R is installed, we'll download the interoperability package, Rserve . In my
case, I went to http://www.rforge.net/Rserve/files/ and downloaded
Rserver_1.88-1.tar.gz , but you might have a more recent version available.
2.
You'll need to extract the iles from the tarball that you've downloaded. On Windows,
7-Zip ( http://www.7-zip.org/ ) can help:
$ tar xfzv Rserve_1.88-1.tar.gz
x Rserve/
x Rserve/configure.win
x Rserve/cleanup
 
Search WWH ::




Custom Search