Commonest

Commonest[list]
gives a list of the elements that are the most common in list.

Commonest[list,n]
gives a list of the n most common elements in list.

DetailsDetails

  • When several elements occur with equal frequency, Commonest[list,] picks first the ones that occur first in list.
  • Commonest[list,n] returns the n commonest elements in the order they appear in list.
  • Commonest[list,UpTo[n]] returns the n commonest elements, or as many as are available.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

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]=

Obtain the 6 most common elements, or as many as there are if fewer:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2007
(6.0)
| Updated in 2015
(10.3)
Translate this page: