What Is Incanter? A Clojure-Based Statistical Computing Environment
Updated
Incanter is a Clojure-based, R-like platform for statistical computing and graphics. It can be used either as a standalone, interactive data analysis environment or embedded within other analytics systems as a modular suite of libraries. If you already work in Clojure or on the JVM and want R-style statistical programming without leaving that ecosystem, Incanter is built for exactly that use case.
What Incanter Provides
According to the project's own description, Incanter ships with these functional areas:
- Charting & visualization functions
- Mathematical functions
- Statistical functions
- Matrix & linear algebra functions
- Data manipulation functions
- Interactive, dynamic, functional statistical programming on the JVM
The design goal is to combine two things: the power of Clojure as a dynamically-typed, functional language, and the rich set of libraries already available on the JVM for accessing, processing, and visualizing data.
What It's Built On
Incanter is not a from-scratch numerics stack. At its core it leverages existing JVM libraries:
| Component | Role |
|---|---|
| Parallel Colt | Multithreaded numerics library (a multithreaded version of Colt) |
| JFreeChart | Charting library |
| Processing | Visualization library |
| Other Java and Clojure libraries | Supporting functionality |
The project argues that Clojure's seamless Java integration makes leveraging these libraries simpler than is possible in R, while Incanter's R-like semantics and interactive shell make statistical programming simpler than in pure Java.
Why Clojure for Data Work
The project points to Clojure's fit for data processing through:
- Sequence-oriented data structures, extendable via the sequence abstraction
- Powerful sequence-processing functions
- Destructuring
- Data structure literals
- A growing list of third-party libraries
Design Lineage
Incanter's approach is not novel in kind. Its motivation traces to Back to the Future: Lisp as a Base for a Statistical Computing System by Ihaka and Lang (2008), and it draws inspiration from the now-dormant Lisp-Stat (see the 2005 Journal of Statistical Software special volume, "Lisp-Stat: Past, Present, and Future"). The motivation for a JVM-based Lisp comes from Clojure itself.
How to Get Started
The project lists several entry points:
- Download a pre-built version of Incanter, or
- Grab the latest source code from the GitHub repository, then
- Visit the getting started page.
Incanter is also hosted on Clojars for those using Leiningen or Maven-based tools. It can be added as a dependency with a single line in a Leiningen project.clj file, or a few lines of XML in a Maven pom.xml file.
For examples of statistical programming with Incanter, the project directs readers to its documentation.
When Incanter Fits
Choose Incanter if you want R-like statistical and graphics workflows while staying inside Clojure and the JVM, or if you need a modular suite of statistical libraries to embed in a larger analytics system. If you don't use Clojure or the JVM, the integration advantages the project emphasizes won't apply to you.