Skip to content

Instantly share code, notes, and snippets.

@liebke
Created May 30, 2010 23:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liebke/419403 to your computer and use it in GitHub Desktop.
Save liebke/419403 to your computer and use it in GitHub Desktop.
(use '(incanter core charts excel))
;; read .xls file of Australian airline passenger data from the 1950s.
(with-data (read-xls "http://incanter.org/data/aus-airline-passengers.xls")
(view $data)
;; time-series-plot needs time in millisecs
;; create a function, to-millis, to convert a sequence of Date objects
;; to a sequence of milliseconds
(let [to-millis (fn [dates] (map #(.getTime %) dates))]
(view (time-series-plot (to-millis ($ :date)) ($ :passengers)))))
;; save one of the built-in sample datasets as an xls file.
(use '(incanter core datasets excel))
(save-xls (get-dataset :cars) "/tmp/cars.xls")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment