CARVIEW |
Every repository with this icon (

Every repository with this icon (

Description: | Clojure-based, R-like statistical computing and graphics environment for the JVM |
Homepage: | https://incanter.org |
Clone URL: |
git://github.com/liebke/incanter.git
Give this clone URL to anyone.
git clone git://github.com/liebke/incanter.git
|
- Overview
- Getting started with Clojure
- Getting started with Incanter
- Documentation and examples
- Building Incanter
- Dependencies
Overview and motivation
Incanter is a Clojure-based, R-like statistical computing and graphics environment for the JVM. At the core of Incanter are the Parallel Colt numerics library, a multithreaded version of Colt, and the JFreeChart charting library, as well as several other Java and Clojure libraries.
The motivation for creating Incanter is to provide R-like semantics (if not always syntax) and interactive-programming environment to the development of stand-alone statistical applications, with web or gui front-ends, as well as to the development of statistical applications that need to plug into an existing software infrastructure in order to consume data, from databases or other information systems, or drive other processes. Clojure’s seamless integration with Java makes this kind of development much simpler than is possible in R, and Incanter’s R-like semantics makes it much simpler than is possible in pure Java.
Motivation for a Lisp-based R-like statistical environment can be found in the paper Back to the Future: Lisp as a Base for a Statistical Computing System by Ihaka and Lang (2008). Incanter is also inspired by the now dormant Lisp-Stat (see the special volume in the Journal of Statistical Software on Lisp-Stat: Past, Present, and Future from 2005).
Motivation for a JVM-based Lisp can be found at the Clojure website, and screencasts of several excellent Clojure talks by the language’s creator, Rich Hickey, can be found at clojure.blip.tv.
Getting started with Clojure
For a great introduction to programming in Clojure, read Clojure – Functional Programming for the JVM. by R. Mark Volkmann. For an even more extensive introduction, get the newly released book Programming Clojure by Stuart Halloway.
Other Clojure resources
- Clojure website
- Clojure Google group
- clojure.blip.tv
- Clojure Programming Wikibook
- Learning Clojure Wikibook
Getting started with Incanter
Start the Clojure shell (aka the REPL) from the Incanter directory: bin/clj
. (Note: bin/clj
is a bash script, and won’t run on Windows systems as is.)
From the Clojure shell, load the Incanter libraries:
(use '(incanter core stats charts))
Try an example: sample 1,000 values from a standard-normal distribution and view a histogram:
(view (histogram (sample-normal 1000)))

The online documentation for most Incanter functions contain usage examples. The documentation can be viewed using Clojure’s doc
function. For example, to view the documentation and usage examples for the linear-model
function, call (doc linear-model)
from the Clojure shell. Use (find-doc "search term")
to search the online documentation from the Clojure shell. The API documentation can also be found in the docs/api/
directory and online at https://incanter.org/docs/api/.
More Incanter examples
- See Incanter wiki
- See the
examples/
directory andtests/test-cases.clj
for additional usage examples- Run
examples/run_prob_plots.clj
to generate example probability distribution plots - Run
tests/runtests.clj
to run test cases
- Run
Documentation
The following documentation covers the Incanter and Clojure APIs and the APIs of the underlying java libraries.
Incanter documentation Related API documentationBuilding Incanter
The Incanter distribution includes a pre-built jar file, but if you would like to build it, test it, and generated the api documentation yourself, run the following commands from the Incanter directory:
- Build incanter.jar:
ant
- Run unit tests:
tests/runtests.clj
- Generate API docs:
bin/generate_docs.clj
(Note: the bin/clj
and *.clj
scripts won’t run on Windows systems as is. Although, the Clojure code contained in the *.clj
scripts can be run from the Clojure shell.)
Included dependencies
See lib/license.txt
file for license terms of included libraries.
- Clojure
- Parallel Colt
- Netlib-Java (included with Parallel Colt)
- JFreeChart
- OpenCSV
- JGraph (for future development)
- Clojure-Contrib (test-is, gen-html-docs, repl-utils)
- JLine