One more solution, which works for both numeric & character/factor data:

Mode <- function(x) {
  ux <- unique(x)
  ux[which.max(tabulate(match(x, ux)))]
}

On my dinky little machine, that can generate & find the mode of a 10M-integer vector in about half a second.

If your data set might have multiple modes, the above solution takes the same approach as which.max, and returns the first-appearing value of the set of modes. To return all modes, use this variant (from @digEmAll in the comments):

Modes <- function(x) {
  ux <- unique(x)
  tab <- tabulate(match(x, ux))
  ux[tab == max(tab)]
}
Answer from Ken Williams on Stack Overflow
🌐
CalculatorSoup
calculatorsoup.com › calculators › statistics › mean-median-mode.php
Mean, Median, Mode Calculator
Count how many times each number occurs in the data set. The mode is the number with the highest tally. It's ok if there is more than one mode. And if all numbers occur the same number of times there is no mode.
🌐
Investopedia
investopedia.com › terms › m › mode.asp
Mode: What It Is in Statistics and How to Calculate It
July 14, 2025 - To find the mode, simply count how many times each value appears in the dataset. ... In statistics, the mode is the number that occurs most often in a set of data.
🌐
GeeksforGeeks
geeksforgeeks.org › mathematics › what-is-mode
Mode in Statistics: Definition, Examples, How to Calculate Mode - GeeksforGeeks
September 20, 2021 - To determine the mode, count how frequently each number appears. Mode can be calculated for both numerical and categorical data. It is symbolised as Z or M0. ... Example: In the given set of data of balloons: 1, 2, 2, 3, 3, 3, 4, 4, the mode ...
🌐
Indeed
indeed.com › career guide › career development › how to calculate mode in statistics (with examples)
How To Calculate Mode in Statistics (With Examples) | Indeed.com
September 4, 2024 - With a simple distribution graph, ... ways, including: To find the mode manually, arrange the numbers in ascending or descending order, then count how often each number appears....
🌐
Statistics By Jim
statisticsbyjim.com › home › blog › how to find the mode
How to Find the Mode - Statistics By Jim
June 23, 2025 - For larger datasets, you can find the mode using a frequency table. Learn about frequency tables and how to make them with Excel. For example, the frequency table below contains 126 observations.
🌐
Statistics How To
statisticshowto.com › home › how to find the mode or modal value
How to Find the Mode or Modal Value - Statistics How To
May 10, 2024 - For example, if you have one set, type your data into F1 to F20. Step 2: Type “=MODE(F1:F20)” where “F1:F20” is the location of your data set. Step 3: Press “Enter.” That’s it!
🌐
Wikipedia
en.wikipedia.org › wiki › Mode_(statistics)
Mode (statistics) - Wikipedia
January 26, 2005 - If X is a discrete random variable, the mode is the value x at which the probability mass function P(X) takes its maximum value, i.e., x = argmaxxi P(X = xi). In other words, it is the value that is most likely to be sampled.
🌐
Statistics Canada
www150.statcan.gc.ca › n1 › edu › power-pouvoir › ch11 › mode › 5214873-eng.htm
4.4.3 Calculating the mode
The distribution for this example is bimodal, with a major mode corresponding to the modal-class interval 160 to 179 centimetres and a minor mode corresponding to the modal-class interval 80 to 99 centimetres. The modal class shouldn’t be used as a measure of central tendency, but finding two modes gives us an indication that there could be two distinct groups in the data that should be analyzed separately.
Find elsewhere
🌐
Math is Fun
mathsisfun.com › mode.html
How to Calculate the Mode or Modal Value
Arrange them in order: [8, 15, 19, 19, 28, 29, 35] 19 appears twice, all the rest appear only once, so 19 is the mode. ... We can have more than one mode. ... Having two modes is called "bimodal". Having more than two modes is called "multimodal".
🌐
UniversalClass
universalclass.com › articles › math › statistics › how-to-calculate-mean-median-mode.htm
How to Calculate Mean, Median, and Mode
Practice Problem: What is the mode ... (or values) that occurs most frequently. One way to find the mode is to draw a graph of the data (such as a histogram) and find the highest point on the graph....
🌐
Wikihow
wikihow.com › education and communications › studying › mathematics › probability and statistics › how to find the mode of a set of numbers: quick & easy steps
How to Find the Mode of a Set of Numbers: Quick & Easy Steps
February 16, 2025 - To find the mode of a set of numbers, write down the numbers of your data set. Order the numbers from smallest to largest, and then count each time a number repeats itself. The mode is the number that appears most often.
🌐
Online Math Learning
onlinemathlearning.com › mode.html
Statistics: Mode (video lessons, examples, solutions)
Find the middle value: If the count ... the average (mean) of the two middle numbers. III. Mode The mode is the value that appears most frequently in a data set....
🌐
Laerd Statistics
statistics.laerd.com › statistical-guides › measures-central-tendency-mean-mode-median.php
Mean, Mode and Median - Measures of Central Tendency - When to use with Different Types of Variable and Skewed Distributions | Laerd Statistics
They are also classed as summary statistics. The mean (often called the average) is most likely the measure of central tendency that you are most familiar with, but there are others, such as the median and the mode. The mean, median and mode are all valid measures of central tendency, but under different conditions, some measures of central tendency become more appropriate to use than others. In the following sections, we will look at the mean, mode and median, and learn how to calculate them and under what conditions they are most appropriate to be used.
🌐
Virtual Nerd
virtualnerd.com › middle-math › probability-statistics › mean-median-mode-range › mode-data-set
How Do You Find the Mode of a Data Set? | Virtual Nerd
The mode of a data set is the number that occurs most frequently in the set. To easily find the mode, put the numbers in order from least to greatest and count how many times each number occurs. The number that occurs the most is the mode!
🌐
BYJUS
byjus.com › maths › mode
When there are two modes in a data set, then the set is called
October 14, 2021 - Find the mode of the given distribution. To know more about measures of central tendency and mode of data, download BYJU’S – The Learning App. ... A mode, in statistics, is defined as the value that has higher frequency in a given set of values.
🌐
Scribbr
scribbr.com › home › how to find the mode | definition, examples & calculator
How to Find the Mode | Definition, Examples & Calculator
June 21, 2023 - Ads help us keep our tools free for everyone. Scribbr customers enjoy an ad-free experience! Measures of central tendency help you find the middle, or average, of a data set. Mean, median and mode are the 3 main measures. ... Levels of measurement tell you how precisely variables are recorded. The level of measurement determines how you can analyze your data. ... Descriptive statistics summarize the characteristics of a data set.
🌐
Purplemath
purplemath.com › modules › meanmode.htm
Mean, median, and mode: they're ALL averages...? | Purplemath
The mode is the number that is repeated more often than any other, so 13, I see from my listing above, is the mode. The largest value in the list is 21, and the smallest is 13, so the range is 21 − 13 = 8. ... Note: The formula for the place ...
🌐
Cuemath
cuemath.com › data › mode
Mode - Formula, Meaning, Example | How to Find Mode?
In statistics, the mode formula is defined as the formula to calculate the mode of a given set of data. Mode refers to the value that is repeatedly occurring in a given set and mode is different for grouped and ungrouped data sets.