{"id":13442435,"url":"https://github.com/incanter/incanter","last_synced_at":"2025-04-29T14:39:30.560Z","repository":{"id":520624,"uuid":"148903","full_name":"incanter/incanter","owner":"incanter","description":"Clojure-based, R-like statistical computing and graphics environment for the JVM","archived":false,"fork":false,"pushed_at":"2023-11-10T07:21:02.000Z","size":42571,"stargazers_count":2241,"open_issues_count":76,"forks_count":293,"subscribers_count":116,"default_branch":"master","last_synced_at":"2024-10-29T14:56:25.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://incanter.org","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/incanter.png","metadata":{"files":{"readme":"README.textile","changelog":"Changes.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2009-03-12T02:58:47.000Z","updated_at":"2024-10-28T16:38:10.000Z","dependencies_parsed_at":"2024-01-08T18:15:42.742Z","dependency_job_id":null,"html_url":"https://github.com/incanter/incanter","commit_stats":{"total_commits":1278,"total_committers":132,"mean_commits":9.681818181818182,"dds":0.661189358372457,"last_synced_commit":"e0a03aac237fcc60587278a36bd2e76266fc6356"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/incanter%2Fincanter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/incanter%2Fincanter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/incanter%2Fincanter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/incanter%2Fincanter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/incanter","download_url":"https://codeload.github.com/incanter/incanter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251520465,"owners_count":21602506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:45.673Z","updated_at":"2025-04-29T14:39:30.531Z","avatar_url":"https://github.com/incanter.png","language":"Clojure","funding_links":[],"categories":["Clojure","数据科学","Science and Data Analysis"],"sub_categories":[],"readme":"\u003ca border=\"0\" href=\"http://incanter.org\" \u003e\u003cimg src=\"http://incanter.org/incanter-banner.png\" alt=\"Incanter\" /\u003e\u003c/a\u003e\n\n\u003ca border=\"0\" href=\"https://travis-ci.org/incanter/incanter\" \u003e \u003cimg src=\"https://secure.travis-ci.org/incanter/incanter.png\" alt=\"Incanter\" /\u003e\u003c/a\u003e\n\n* \u003ca href=\"#overview\"\u003eOverview\u003c/a\u003e\n* \u003ca href=\"#clojure\"\u003eGetting started with Clojure\u003c/a\u003e\n* \u003ca href=\"#getstarted\"\u003eGetting started with Incanter\u003c/a\u003e\n** \u003ca href=\"#include-in-clojure-project\"\u003eInclude in Clojure project\u003c/a\u003e\n** \u003ca href=\"#use-standalone-app\"\u003eUse standalone app\u003c/a\u003e\n** \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\n* \u003ca href=\"#docs\"\u003eDocumentation and examples\u003c/a\u003e\n* \u003ca href=\"#build\"\u003eBuilding Incanter\u003c/a\u003e\n* \u003ca href=\"#depends\"\u003eDependencies\u003c/a\u003e\n\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\n\nh2. Overview and motivation\n\n\u003ca href=\"http://incanter.org\"\u003e_Incanter\u003c/a\u003e is a \u003ca href=\"http://clojure.org\"\u003eClojure\u003c/a\u003e-based, \u003ca href=\"http://www.r-project.org/\"\u003eR\u003c/a\u003e-like statistical computing and graphics environment for the JVM._  At the core of Incanter are the \u003ca href=\"http://sites.google.com/site/piotrwendykier/software/parallelcolt\"\u003eParallel Colt\u003c/a\u003e numerics library, a multithreaded version of \u003ca href=\"http://acs.lbl.gov/~hoschek/colt/\"\u003eColt\u003c/a\u003e, and the \u003ca href=\"http://www.jfree.org/jfreechart/\"\u003eJFreeChart\u003c/a\u003e charting library, as well as several other Java and Clojure libraries.\n\nThe motivation for creating Incanter is to provide a JVM-based statistical computing and graphics platform with R-like semantics and interactive-programming environment. Running on the JVM provides access to the large number of existing Java libraries for data access, data processing, and presentation.  Clojure’s seamless integration with Java makes leveraging these libraries much simpler than is possible in R, and Incanter’s R-like semantics makes statistical programming much simpler than is possible in pure Java.\n\nMotivation for a Lisp-based R-like statistical environment can be found in the paper \u003ci\u003e\u003ca href=\"http://www.stat.auckland.ac.nz/~ihaka/downloads/Compstat-2008.pdf\"\u003eBack to the Future: Lisp as a Base for a Statistical Computing System by Ihaka and Lang (2008)\u003c/a\u003e\u003c/i\u003e. Incanter is also inspired by the now dormant Lisp-Stat (see the special volume in the Journal of Statistical Software on \u003ca href=\"http://www.jstatsoft.org/v13\"\u003eLisp-Stat: Past, Present, and Future\u003c/a\u003e from 2005).\n\nMotivation for a JVM-based Lisp can be found at the \u003ci\u003e\u003ca href=\"http://clojure.org\"\u003eClojure website\u003c/a\u003e\u003c/u\u003e\u003c/i\u003e, and screencasts of several excellent Clojure talks by the language’s creator, Rich Hickey, can be found at \u003ci\u003e \u003ca href=\"http://www.youtube.com/user/ClojureTV\"\u003eClojure TV\u003c/a\u003e\u003c/i\u003e.\n\n\n\u003ca name=\"clojure\"\u003e\u003c/a\u003e\n\nh2. Getting started with Clojure\n\nFor a great introduction to programming in Clojure, read \"Clojure - Functional Programming for the JVM.\":https://objectcomputing.com/resources/publications/sett/march-2009-clojure-functional-programming-for-the-jvm by R. Mark Volkmann. For an even more extensive introduction, get one of the books on Clojure \"Programming Clojure, 2ed\":http://pragprog.com/book/shcloj2/programming-clojure by Stuart Halloway and Aaron Bedra, \u003ca href=\"http://www.manning.com/fogus/\"\u003e\"The Joy of Clojure\"\u003c/a\u003e by Michael Fogus and Chris Houser, \u003ca href=\"http://www.manning.com/rathore/\"\u003e\"Clojure in Action\"\u003c/a\u003e by Amit Rathore, \u003ca href=\"https://www.apress.com/gp/book/9781430272311\"\u003e\"Practical Clojure\"\u003c/a\u003e by Luke VanderHart and Stuart Sierra.\n\n*Other Clojure resources*\n\n* \"Clojure website\":http://clojure.org\n* \"Getting Started with Clojure\":https://clojure.org/guides/getting_started\n* \"Clojure Google group\":http://groups.google.com/group/ClojureTV\n* \"clojure\":https://www.youtube.com/user/ClojureTV\n* \"Disclojure blog\":http://disclojure.org/\n* \"Full Disclojure screencasts\":http://vimeo.com/channels/fulldisclojure\n\n\n\u003ca name=\"getstarted\"\u003e\u003c/a\u003e\n\nh2. Getting started with Incanter\n\nh4. Include in Clojure project\n\nInclude all incanter modules at once in your \u003ccode\u003eproject.clj\u003c/code\u003e:\n\nbc[clojure]. :dependencies [[org.clojure/clojure \"1.9.0\"]\n               [incanter \"1.9.3\"]]\n\n\nOr only the modules you need:\n\nbc. :dependencies [[org.clojure/clojure \"1.9.0\"]\n               [incanter/incanter-core \"1.9.3\"]\n               [incanter/incanter-charts \"1.9.3\"]]\n\nStart repl:\n\nbc. lein repl\n\n\nh4. Use standalone app\n\nStart by visiting the \u003ca href=\"http://incanter.org\"\u003eIncanter website\u003c/a\u003e for an overview, checkout the \u003ca href=\"http://data-sorcery.org/contents/\"\u003edocumentation page\u003c/a\u003e for a listing of HOW-TOs and examples, and then download either an \u003ca href=\"http://incanter.org/downloads/\"\u003eIncanter executable\u003c/a\u003e or a pre-built version of \u003ca href=\"http://incanter.org/downloads/\"\u003ethe latest build of Incanter\u003c/a\u003e, which includes all the necessary dependencies, and unpack the file (if you would like to build it from source, read \u003ca href=\"#build\"\u003eBuilding Incanter\u003c/a\u003e).  You also might need to install libgfortran3 library that is required for \u003ca href=\"http://mikiobraun.github.io/jblas/\"\u003ejblas\u003c/a\u003e that is powering matrix operations (see \u003ca href=\"https://github.com/mikiobraun/jblas/wiki/Missing-Libraries\"\u003ejblas wiki\u003c/a\u003e for more details).\n\nStart the Clojure REPL (aka the shell) by double-clicking on the downloaded executable or, if you downloaded the pre-built distribution, running one of the scripts in the Incanter directory: @script/repl@ or @script\\repl.bat@ on Windows.\n\nh4. Usage\n\nFrom the Clojure REPL, load the Incanter libraries: \n\u003cpre\u003e\u003ccode\u003euser=\u003e (use '(incanter core stats charts io))\u003c/code\u003e\u003c/pre\u003e\n\nTry an example: sample 1,000 values from a standard-normal distribution and view a histogram: \n\u003cpre\u003e\u003ccode\u003euser=\u003e (view (histogram (sample-normal 1000)))\u003c/code\u003e\u003c/pre\u003e\n\u003cimg src=\"http://incanter.org/images/examples/newtheme/hist-norm.png\" /\u003e\n\nTry another simple example, a plot of the sine function over the range -10 to 10:\n\nbc. user=\u003e (def my-plot (function-plot sin -10 10))\nuser=\u003e (view my-plot)\n\n\u003cimg src=\"http://incanter.org/images/examples/newtheme/xy-sin.png\" /\u003e\n\nYou can save plots into a png file:\n\u003cpre\u003e\u003ccode\u003euser=\u003e (save my-plot \"plot.png\")\u003c/code\u003e\u003c/pre\u003e\n\nIncanter can save charts into pdf or svg files. Check \u003ccode\u003eincanter.pdf/save-pdf\u003c/code\u003e and \u003ccode\u003eincanter.svg/save-svg\u003c/code\u003e functions.\n\nLet's play with some data now. We'll look at London weather for 2012:\n\nbc.. ; function that returns dataset containing weather in London for given month in 2012\n(defn weather-for-month [month]\n  (-\u003e (format \"https://www.wunderground.com/history/airport/EGLL/2012/%d/10/MonthlyHistory.html?format=1\" month)\n      (read-dataset :header true)))\n\n; get weather data for each month in 2012 and build single dataset\n(def data (-\u003e\u003e (range 1 13) (map weather-for-month) (apply conj-rows)))\n\n; view dataset in a table and view histogram of mean temperature\n(view data)\n; wunderground.com formats temperature depending on locale/location/whatever \n; so you might need to use \"Mean TemperatureF\" otherwise you'll get NullPointerException.\n(view (histogram \"Mean TemperatureC\" :nbins 100 :data data))\n\n; function that given month \"2012-9-20\" extracts month and returns 9\n(defn month [date] (Integer/parseInt (second (.split date \"-\"))))\n\n; dataset that contains 2 columns: month and mean temperature for that month\n; don't forget to change to \"Mean TemperatureF\" if you did so few steps back.\n(def grouped-by-month\n  (-\u003e\u003e (map (fn [date temp] {:month (month date) :temp temp})\n            ($ \"GMT\" data) ($ \"Mean TemperatureC\" data))\n       to-dataset\n       ($rollup :mean :temp :month)\n       ($order :month :asc)))\n\n; view line chart that shows that August was the warmest month\n(view (line-chart :month :temp :data grouped-by-month))\n\np. 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 at \u003ca href=\"http://incanter.github.io/incanter/\"\u003ehttp://incanter.github.io/incanter/\u003c/a\u003e.\n\nThe \u003ca href=\"http://www.amazon.com/gp/product/178216264X/ref=as_li_ss_tl?ie=UTF8\u0026camp=1789\u0026creative=390957\u0026creativeASIN=178216264X\u0026linkCode=as2\u0026tag=statisprograw-20\"\u003eClojure Data Analysis Cookbook\u003c/a\u003e (published by Packt Publishing) contains several chapters dedicated to Incanter, including work with datasets, charting, etc.  You can read the \u003ca href=\"https://github.com/incanter/incanter/blob/master/docs/9781782162643_Chapter%206.pdf?raw=true\"\u003esample chapter\u003c/a\u003e that describes Incanter's datasets.\n\nThere is dedicated mailing list for discussions about Incater. It's hosted on \u003ca href=\"http://groups.google.com/group/incanter\"\u003eGoogle Groups\u003c/a\u003e.\n\n*More Incanter examples*\n\n* See the \u003ca href=\"http://data-sorcery.org\"\u003eData-Sorcery blog\u003c/a\u003e\n* See the \u003ca href=\"http://data-sorcery.org/contents\"\u003eDocumentation table of contents\u003c/a\u003e\n\n\u003ca name=\"docs\"\u003e\u003c/a\u003e\n\nh2. Documentation\n\nThe following documentation covers the Incanter and Clojure APIs and the APIs of the underlying java libraries.\n\n*Incanter documentation*\n* \"Doc Index\":http://data-sorcery.org/contents/\n* \"API\":http://incanter.github.io/incanter/\n\n\n*Related API documentation*\n* \"Clojure API\":http://clojure.github.com/clojure/\n* \"Parallel Colt Java API\":http://incanter.org/docs/parallelcolt/api/\n* \"JFreeChart Java API\":http://www.jfree.org/jfreechart/api/javadoc/index.html\n* \"Processing API\":http://www.processing.org/reference/\n\n\n\u003ca name=\"build\"\u003e\u003c/a\u003e\n\nh2. Building Incanter\n\nTo build and test Incanter, you will need to have \u003ca href=\"https://github.com/technomancy/leiningen/\"\u003eLeiningen\u003c/a\u003e and \u003ca href=\"http://git-scm.com/\"\u003egit\u003c/a\u003e installed:\n\n1. Clone the repository with git: @git clone git://github.com/incanter/incanter.git@\n\n2. Install Leiningen (version 2.x)\n  a. Download the lein script: @wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein@\n     (use \u003ca href=\"https://github.com/technomancy/leiningen/raw/preview/bin/lein.bat\"\u003elein.bat\u003c/a\u003e on Windows)\n  b. Place it on your path and chmod it to be executable: @chmod +x lein@\n  c. Run: @lein self-install@\n\n3. Execute @lein sub install@ (or @lein modules install@) staying in the incanter directory - this will download all necessary dependencies, compile \u0026 install all Incanter's modules into local Maven repository.\n\n4. Start a REPL: @lein repl@ (it also starts nRepl server), or start a Swank server: @lein ritz 4005@\n\nOther tasks:\n* If you want to run the tests for each of Incanter's modules, use @lein sub test@ \n* Each of Incanter's modules are independent Leiningen projects. Just cd into modules/incanter-* and use Leiningen to build each one as a stand-alone library.\n* @lein sub install@ (or @lein modules install@) uses Leiningen to build all the modules and install them in your local ~/.m2 repository.\n\n\n\u003ca name=\"depends\"\u003e\u003c/a\u003e\n\nh2. Incanter dependencies\n\n* \"Clojure\":https://github.com/clojure/clojure\n* \"Parallel Colt\":http://sites.google.com/site/piotrwendykier/software/parallelcolt\n** \"Netlib-Java\":http://code.google.com/p/netlib-java/ (included with Parallel Colt)\n* \"Clatrix\":https://github.com/tel/clatrix\n** \"jblas\":https://github.com/mikiobraun/jblas\n* \"JFreeChart\":http://www.jfree.org/jfreechart/\n** \"JCommon\":http://www.jfree.org/jcommon/ (included with JFreeChart)\n** \"GnuJaxp\":http://www.gnu.org/software/classpathx/jaxp/jaxp.html (included with JFreeChart)\n* \"OpenCSV\":http://opencsv.sourceforge.net/\n* \"iText\":http://itextpdf.com/\n* \"Congomongo\":https://github.com/aboekhoff/congomongo\n* \"JLaTeXMath\":http://forge.scilab.org/index.php/p/jlatexmath/\n* \"Apache POI\":http://poi.apache.org/\n* \"JLine\":http://jline.sourceforge.net/\n* \"ClojureQL\":https://clojureql.sabrecms.com/\n* \"Batik SVG Toolkit\":https://xmlgraphics.apache.org/batik/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincanter%2Fincanter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincanter%2Fincanter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincanter%2Fincanter/lists"}