This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Tally

Tally[list]
tallies the elements in list, listing all distinct elements together with their multiplicities.
Tally
uses test to determine whether pairs of elements should be considered equivalent, and gives a list of the first representatives of each equivalence class, together with their multiplicities.
  • Tally[list] lists distinct elements in the order they appear in list.
Obtain tallies for a list of symbols:
Use test argument to count expressions with the same Head:
Obtain tallies for a list of symbols:
In[1]:=
Click for copyable input
Out[1]=
 
Use test argument to count expressions with the same Head:
In[1]:=
Click for copyable input
Out[1]=
Results are returned in order of first occurrence in the list:
Count the instances of randomly generated integers:
Elements of the list can be any expression:
Count occurrences of characters in a string:
Elements with highest frequencies are given by Commonest:
A sorted Tally is equivalent to a list of counts for the Union:
Tally is a discrete analog of BinCounts:
New in 6