A matrix is a two-dimensional grid of numbers. The dimensions are expressed as the number of rows and columns in the matrix.

For example, A is a matrix with four rows and two columns:


In mathematical notation, a matrix will usually be assigned to a variable with an upper-case letter to distinguish it from other variables in an equation.

We can construct a matrix from our dataset using Incanter's incanter.core/to-matrix function:

(defn ex-3-16 []
  (->> (swimmer-data)
       (i/$ ["Height, cm" "Weight"])

Incanter also defines the incanter.core/matrix function that will take a sequence of scalar values or a sequence of sequences and convert ...

Get Clojure for Data Science now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.