Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > List Manipulation > Math & Counting Operations on Lists > Commonest >
Mathematica > Data Manipulation > Handling Arrays of Data > Math & Counting Operations on Lists > Commonest >
Mathematica > Data Manipulation > Image Processing & Analysis > Basic Image Manipulation > Handling Arrays of Data > Math & Counting Operations on Lists > Commonest >

Commonest

Commonest[list]
gives a list of the elements that are the most common in list.
Commonest
gives a list of the n most common elements in list.
  • When several elements occur with equal frequency, Commonest picks first the ones that occur first in list.
  • Commonest returns the n commonest elements in the order they appear in list.
Obtain the elements with the highest frequency:
Obtain the 4 most common elements:
Obtain the elements with the highest frequency:
In[1]:=
Click for copyable input
Out[1]=
 
Obtain the 4 most common elements:
In[1]:=
Click for copyable input
Out[1]=
Elements of the list can be any expressions:
Find the mode of a set of random integers:
Find the most frequently occurring elements in the columns of a matrix:
Commonest gives elements with the largest Tally values:
A message is generated if there are fewer distinct elements than requested:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF