Skip to content

Instantly share code, notes, and snippets.

(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)))))
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
-- needed for creating [Char] instances
{-# LANGUAGE FlexibleInstances #-}
-- Use the following to allow records to have name field names.
-- {-# LANGUAGE DuplicateRecordFields #-}
module Lib