Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

TakeLargest

TakeLargest[list,n]
gives the n numerically largest elements in list, sorted in descending order.

TakeLargest[n]
represents an operator form of TakeLargest that can be applied to an expression.

Details and OptionsDetails and Options

ExamplesExamplesopen allclose all

Basic Examples  (5)Basic Examples  (5)

Take the two largest numbers in a list:

In[1]:=
Click for copyable input
Out[1]=

Do the same using the operator form of TakeLargest:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Take the two largest values in an association:

In[4]:=
Click for copyable input
Out[4]=

Get the two largest quantities in a list of Quantity objects:

In[1]:=
Click for copyable input
Out[1]=

Quantities can be present in multiple units:

In[2]:=
Click for copyable input
Out[2]=

Get the two most recent dates in a list of DateObject constructs:

In[1]:=
Click for copyable input
Out[1]=

By default, Missing[] and several other symbolic expressions are excluded from the results:

In[1]:=
Click for copyable input
Out[1]=

Take the 4 largest numbers, or as many as are available if fewer:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2015
(10.1)
| Updated in 2015
(10.3)