Generating summary statistics with $rollup
One of the basic ways of getting a grip on a dataset is to look at some summary statistics: measures of centrality and variance, such as mean and standard deviation. These provide useful insights into our data, help us know what questions to ask next, and know how best to proceed.
Getting ready
First, we'll need to make sure Incanter is listed in the dependencies of our Leiningen project.clj
file:
(defproject statim "0.1.0" :dependencies [[org.clojure/clojure "1.6.0"] [incanter "1.5.5"]])
And we'll need to require these libraries in our script or REPL:
(require '[incanter.core :as i] 'incanter.io '[incanter.stats :as s])
Finally, we'll use the dataset of census race data that we compiled for the Grouping data with $group-by recipe in Chapter 6, Working with Incanter Datasets. We'll bind the file name to the name data-file
. You can download this from http://www.ericrochester.com/clj-data-analysis/data/all_160.P3.csv...