Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

DataReshapers

Guides

  • Data reshaping functions

Tech Notes

  • Data transformation workflows
  • Long form data transformation
  • Wide form data transformation

Symbols

  • CrossTabulate
  • CrossTabulationMatrixQ
  • CrossTensorate
  • CrossTensorateSplit
  • DatasetToMatrix
  • GridTableForm
  • LongFormDataset
  • PivotLonger
  • RecordsSummary
  • RecordsToLongFormDataset
  • RecordsToWideFormDataset
  • SeparateColumn
  • ToAutomaticKeysAssociation
  • TypeOfDataToBeReshaped
  • WideFormDataset
AntonAntonov`DataReshapers`
CrossTabulate
​
CrossTabulate[data]
finds the contingency table for the
Dataset
or array data.
​
Details and Options

Examples  
(13)
Basic Examples  
(2)
Here is an array of random integer-word pairs:
In[1]:=
SeedRandom[4];​​iwPairs=Transpose[{RandomInteger[5,200],RandomChoice[RandomWord[5],200]}];​​Short[iwPairs]
Out[1]//Short=
{{2,dispose},{3,prosecutor},196,{3,skein},{2,dramatize}}
Compute the contingency table:
In[2]:=
CrossTabulate
[iwPairs]
Out[2]=
dispose
dramatize
haunt
prosecutor
skein
0
10
5
7
7
8
1
8
4
4
7
7
2
5
9
3
8
10
3
6
7
2
4
10
4
9
9
11
6
7
5
5
2
8
5
7
​
Here is a
Dataset
, the first two columns of which are categorical columns and the third column which is numeric:
In[1]:=
dataset=Dataset[{​​"a"1,"b""x","c"5,​​"a"2,"b""y","c"6,​​"a"3,"b""z","c"4.5,​​"a"1,"b""x","c"10,​​"a"2,"b""y","c"100,​​"a"3,"b""z","c"Missing[]}]
Out[1]=
a
b
c
1
x
5
2
y
6
3
z
4.5
1
x
10
2
y
100
3
z
—
Compute the contingency table:
In[2]:=
CrossTabulate
[dataset]
Out[2]=
x
y
z
1
15
0
0
2
0
106
0
3
0
0
4.5+Missing[]
Scope  
(3)

Options  
(1)

Applications  
(2)

Properties & Relations  
(3)

Possible Issues  
(1)

Neat Examples  
(1)

SeeAlso
LongFormDataset
 
▪
CrossTensorate
 
▪
CrossTabulationMatrixQ
RelatedGuides
▪
Data reshaping functions
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com