Slices data by one dimension, returning a Matrix.
The following code creates a Cube, slicing and dicing the squad data for a football team by player position and country:
const y = dimension(countries, (country: string) => (player: Player) => player.country === country); // using a user-defined generatorconst cube: Matrix<Player> = slice(squad, y); Copy
const y = dimension(countries, (country: string) => (player: Player) => player.country === country); // using a user-defined generatorconst cube: Matrix<Player> = slice(squad, y);
This is equivalent to pivot with one dimension.
The type of the source data to be sliced.
The source data, an array of objects.
The dimension to slice the data by.
Slices data by one dimension, returning a Matrix.
Example
The following code creates a Cube, slicing and dicing the squad data for a football team by player position and country:
Remarks
This is equivalent to pivot with one dimension.