Slices and dices source data by one or more dimensions, returning, Matrix, Cube or Hypercube depending on the number of dimensions passed. See the overloads for more detail.

The following code creates a Cube, slicing and dicing the squad data for a football team by player position and country:

const x = dimension(positions, property<Player>('position')); // using the built-in dimension generator matching a property
const y = dimension(countries, (country: string) => (player: Player) => player.country === country); // using a user-defined generator

const cube: Cube<Player> = pivot(squad, y, x);