Learn

Mode in R

Mode

The formal definition for the mode of a dataset is:

*The most frequently occurring observation in the dataset. A dataset can have multiple modes if there is more than one value with the same maximum frequency.*

While you may be able to find the mode of a small dataset by simply looking through it, if you have trouble, we recommend you follow these two steps:

- Find the frequency of every unique number in the dataset
- Determine which number has the highest frequency

#### Example

Say we have a dataset with the following ten numbers:

`$24,\ 16,\ 12,\ 10,\ 12,\ 28,\ 38,\ 12,\ 28,\ 24$`

Let’s find the frequency of each number:

24 |
16 |
12 |
10 |
28 |
38 |
---|---|---|---|---|---|

2 | 1 | 3 | 1 | 2 | 1 |

From the table, we can see that our mode is `12`

, the most frequent number in our dataset.

### Instructions

**1.**

Determine the mode of the ages for the first ten authors in the Le Monde survey:

`$29, 49, 42, 43, 32, 38, 37, 41, 27, 27$`

Save the value to `mode_age`

.

**2.**

Determine the number of authors who were the age of the mode. Save the number to `mode_count`

.