incanterの使用サンプル。
Last active
December 19, 2015 12:59
-
-
Save knjname/5959155 to your computer and use it in GitHub Desktop.
Incanter Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /target | |
| /lib | |
| /classes | |
| /checkouts | |
| pom.xml | |
| pom.xml.asc | |
| *.jar | |
| *.class | |
| .lein-deps-sum | |
| .lein-failures | |
| .lein-plugins | |
| .lein-repl-history | |
| *~ | |
| #* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns incanter-example | |
| (:use [incanter.core] | |
| [incanter.io] | |
| [incanter.charts] | |
| [incanter.datasets])) | |
| ;;; Read a csv file. | |
| (def crimeTable | |
| ;;; You can specify a URL or file path. | |
| (read-dataset "http://hci.stanford.edu/jheer/workshop/data/crime/CrimeStatebyState.csv" | |
| :header true)) | |
| ;;; Shows the first 10 rows of crimeTable. | |
| (head crimeTable) | |
| ;;; Filter dataset elements. | |
| ;; ["Alabama" "Violent Crime" "Murder and nonnegligent Manslaughter" 1960 406] | |
| ;; ["Alabama" "Violent Crime" "Murder and nonnegligent Manslaughter" 1961 427] | |
| ;; ["Alabama" "Violent Crime" "Murder and nonnegligent Manslaughter" 1962 316] | |
| ;; ... | |
| (def alabamaViolentCrimes | |
| ($where {:State "Alabama" (keyword "Type of Crime") "Violent Crime"} crimeTable)) | |
| ;; View a spreadsheet of crimeTable | |
| (with-data crimeTable | |
| (view alabamaViolentCrimes)) | |
| ;;; Display the charts of alabamaViolentCrimes with JFrame. | |
| (view | |
| (with-data | |
| ($where {:Crime "Aggravated assault" :Year {:$gt 1995}} alabamaViolentCrimes) | |
| (bar-chart ($map int :Year) | |
| :Count | |
| :title "Alabama's aggravated assault count since 1995" | |
| :x-label "Count of crimes" | |
| :y-label "Year"))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defproject incanter-example "0.1.0-SNAPSHOT" | |
| :description "FIXME: write description" | |
| :dependencies [[org.clojure/clojure "1.5.1"] | |
| ;; すげーJARをダウンロードしまくるよ | |
| [incanter "1.4.1"]] | |
| :source-paths ["."]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment