Chapter 6. Working with Incanter Datasets

In this chapter, we will cover the following recipes:

  • Loading Incanter's sample datasets
  • Loading Clojure data structures into datasets
  • Viewing datasets interactively with view
  • Converting datasets to matrices
  • Using infix formulas in Incanter
  • Selecting columns with $
  • Selecting rows with $
  • Filtering datasets with $where
  • Grouping data with $group-by
  • Saving datasets to CSV and JSON
  • Projecting from multiple datasets with $join

Introduction

We've seen Incanter (http://incanter.org/) earlier in this book, but we'll spend a lot more time with this library over the next few chapters. Incanter combines the power to do statistics using a fully-featured statistical language such as R (http://www.r-project.org/) with the ease and joy of Clojure.

Incanter's core data structure is the dataset, so we'll spend some time in this chapter to look at how to use them effectively. While learning basic tools in this manner is often not the most exciting way to spend your time, it can still be incredibly useful. At its most fundamental level, an Incanter dataset is a table of rows. Each row has the same set of columns, much like a spreadsheet. The data in each cell of an Incanter dataset can be a string or a numeric. However, some operations require the data to only be numeric.

First you'll learn how to populate and view datasets, then you'll learn different ways to query and project the parts of the dataset that you're interested in onto a new dataset. Finally, we'll take a look at how to save datasets and merge multiple datasets together.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.202.27