Skip to content

Instantly share code, notes, and snippets.

@nbeloglazov
Created November 11, 2014 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbeloglazov/3093bd4753555aad993f to your computer and use it in GitHub Desktop.
Save nbeloglazov/3093bd4753555aad993f to your computer and use it in GitHub Desktop.
(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