How to Analyze UFC Data with the (ufc_stats) Library for free.

Aayush Sethi
2 min readJun 25, 2021

--

Discover how you can access 20,000+ rows of data with 36 variables just by downloading the ufc_stats library. This is a useful tool for UFC fans and analysts working in the betting industry. Not to mention it is completely free!

Photo by Daniel Lloyd Blunk-Fernández on Unsplash

UFC has gained massive popularity in recent years and is notoriously known for its massive PPVs and the amount of money the sport generates. In this article, I will go over how to fire up the ufc_stats library.

Library Source: https://github.com/mtoto/ufc.stats

1. Download the library through Github

Note: You would need the devtools package installed before running the code.

# Importing Libraries
library(devtools)
devtools::install_github("mtoto/ufc.stats")

2. Save the data in a data frame

I know it’s different, but I prefer using the equal sign and not the usual arrows R coders are used to.

data = data.frame(ufc_stats)
attach(data

3. Let's get ready to Rumble

The dictionary is available in the Github repository. For this article, we will only look at basic EDA techniques to get started with this data.

All variables present in the data set.

EDA

How are the results distributed?

As expected, the majority of UFC fights end in unanimous decisions, as the data suggests a whopping 46% of the UFC bouts result in unanimous decisions.

Who landed the most significant strikes?

ufc_stats %>% group_by(fighter) %>%
summarise(total_significant_strikes = sum(significant_strikes_landed)) %>%
arrange(-total_significant_strikes) %>%
head()
# A tibble: 10 x 2
fighter takedown_successful
<chr> <int>
1 Georges St-Pierre 90
2 Gleison Tibau 84
3 Demetrious Johnson 74
4 Clay Guida 70
5 Frankie Edgar 70
6 Nik Lentz 69
7 Demian Maia 68
8 Colby Covington 61
9 Johny Hendricks 61
10 Khabib Nurmagomedov 61

Please let me know if you have any questions either here, through the comments section, or Linkedin.

--

--