Wolfram Language (aka Mathematica) paclet for data reshaping functions, like, long- and wide form, cross tabulation, etc.
Here we get the Titanic dataset:
dsTitanic = ResourceFunction["ExampleDataset"][{"MachineLearning", "Titanic"}];
dsTitanic[1 ;; -1 ;; 400]
Here is a summary of the dataset:
RecordsSummary[dsTitanic]
Here is computed the contingency table for passenger survival vs class:
CrossTabulate[dsTitanic[All, {"passenger survival", "passenger class"}]]
Here the Titanic dataset is converted into long form:
LongFormDataset[dsTitanic]
Here is computed the contingency tensor for passenger survival vs class vs sex:
cols = {"passenger survival", "passenger class", "passenger sex"};
MatrixForm@
CrossTensorate[Count == Evaluate[(Plus @@ cols)], dsTitanic[All, cols]]
Here is a grid table form of a full integer array with "custom" column names:
SeedRandom[23];
GridTableForm[RandomInteger[100, {5, 7}], TableHeadings -> RandomWord[7]]
[AA1] Anton Antonov, "Contingency tables creation examples", (2016), MathematicaForPrediction at WordPress.
[Wk1] Wikipedia entry, Contingency table.
[Wk2] Wikipedia entry, Wide and narrow data.
[AAf1] Anton Antonov, CrossTabulate, (2019), Wolfram Function Repository.
[AAf2] Anton Antonov, LongFormDataset, (2020), Wolfram Function Repository.
[AAf3] Anton Antonov, WideFormDataset, (2021), Wolfram Function Repository.
[AAf4] Anton Antonov, RecordsSummary, (2019), Wolfram Function Repository.
[AAv1] Anton Antonov, "Multi-language Data-Wrangling Conversational Agent", (2020), YouTube channel of Wolfram Research, Inc.. (Wolfram Technology Conference 2020 presentation.)
[AAv2] Anton Antonov, "Data Transformation Workflows with Anton Antonov, Session #1", (2020), YouTube channel of Wolfram Research, Inc..
[AAv3] Anton Antonov, "Data Transformation Workflows with Anton Antonov, Session #2", (2020), YouTube channel of Wolfram Research, Inc..