This file contains 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 sandbox.core | |
(:use [incanter core io charts])) | |
(use '[incanter core io charts]) | |
(def data (read-dataset "http://xweb.geos.ed.ac.uk/~weather/jcmb_ws/JCMB_2014_Oct.csv" :header true)) | |
(def head-data (head 10 data)) | |
(col-names head-data) | |
(view data) | |
(def wind-speed ($ 3 data)) | |
(view (histogram wind-speed :nbins 100)) | |
(defn get-date [date-string] | |
(-> (.split date-string " ") | |
first | |
(.split "/") | |
last)) | |
(def stripped (to-dataset ($map (fn [date wind] {:date (get-date date) | |
:wind wind}) | |
[:date-time (keyword "wind speed (m/s)")] | |
data))) | |
(view stripped) | |
(with-data (->> ($rollup :mean :wind :date stripped) | |
($order :date :asc)) | |
(view (line-chart :date :wind :title "October 2014, Edinburgh" | |
:y-label "Wind speed (m/s)" | |
:x-label "Day"))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment