Wolfram Computation Meets Knowledge

Rarest

Contributed by: Arnoud Buzing

The rarest elements in a list

ResourceFunction["Rarest"][list]

gives a list of elements that are the rarest in list.

ResourceFunction["Rarest"][list,n]

gives a list of the n rarest elements in list.

Details and Options

When n is given the rarest elements are taken in the order they appear in list.
UpTo[n] is supported, returning as many elements as are available if there are fewer than n.

Examples

Basic Examples

Find the rarest elements:

In[1]:=
ResourceFunction["Rarest"][{1, a, 2, "Hello", 2, 1, 3}]
Out[1]=

Find the 3 rarest elements:

In[2]:=
ResourceFunction["Rarest"][RandomInteger[10, 1000], 3]
Out[2]=

Find where you can avoid UFO sightings:

In[3]:=
ResourceFunction["Rarest"][
 Normal[ResourceData["UFO Sightings 2015"][All, "State"]], 10]
Out[3]=

Resource History