Matrices

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:

Matrices

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"])
       (i/to-matrix)))

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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.