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.
Finally, the motivation for creating Incanter is to provide R-like semantics (if not always syntax) to the development of standalone 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 seemless integration with Java makes this kind of development much simplier than is possible in R, and Incanter’s R-like semantics makes it much simplier than is possible in pure Java.
Additional Clojure resources
- 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 beta version of the book Programming Clojure by Stuart Halloway.
To build and use Incanter, run the following commands from the Incanter directory:
- Build incanter.jar:
- Run unit tests:
- Generate API docs:
- Start the Clojure shell (aka the REPL) from the Incanter directory:
- From the Clojure shell, load the Incanter libraries:
(use '(incanter core stats datasets charts))
- Sample 1,000 values from a standard-normal distribution and view a histogram:
(view (histogram (sample-normal 1000)))
- See the next section for more examples
*.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.)
- The online documentation for most functions contain usage examples. The documentation can be accessed using Clojure’s
docfunction. For example, to view the documentation for the
(doc linear-model)from the Clojure shell. The API documentation is also available in
docs/api/index.htmland online at incanter.org/docs/api/. Use
(find-doc "search term")to search the online documentation from the Clojure shell.