library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(readxl)
UFC_Dataset <- read_excel("~/Downloads/UFC_Dataset.xls")
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
UFC_Dataset$Date <- as.Date(UFC_Dataset$Date, format = "%Y-%m-%d")
UFC_Dataset_2020_Onwards <- UFC_Dataset |>
filter(Date >= as.Date("2020-01-01"))
UFC_Dataset_2020_Onwards <- UFC_Dataset_2020_Onwards |>
mutate(WinningStance = ifelse(Winner == "Red", RedStance, BlueStance))
group_1 <- UFC_Dataset_2020_Onwards |>
group_by(Winner, RedStance,BlueStance,Finish) |>
summarise(frequency = n()) |>
ungroup()
## `summarise()` has grouped output by 'Winner', 'RedStance', 'BlueStance'. You
## can override using the `.groups` argument.
head(group_1)
## # A tibble: 6 Ă— 5
## Winner RedStance BlueStance Finish frequency
## <chr> <chr> <chr> <chr> <int>
## 1 Blue Orthodox Orthodox DQ 3
## 2 Blue Orthodox Orthodox KO/TKO 138
## 3 Blue Orthodox Orthodox M-DEC 6
## 4 Blue Orthodox Orthodox S-DEC 46
## 5 Blue Orthodox Orthodox SUB 74
## 6 Blue Orthodox Orthodox U-DEC 157
group_1_red <- group_1 |> filter(Winner == "Red")
group_1_blue <- group_1 |> filter(Winner == "Blue")
You can also embed plots, for example:
ggplot(group_1_red, aes(x = interaction(Winner, RedStance, BlueStance), y = frequency, fill = Finish)) +
geom_bar(stat = "identity") +
theme(asix.text.x = element_text(angle = 90, hjust = 1)) +
labs(title = "How do fighters Finish their Wins? (2020 Onwards)",
x = "Winner, Red Stance, Blue Stance",
y = "Frequency") +
theme_minimal()
The above reveals many insights. I can see which stances tend to have more success than against other stances. A stance is at the core a fighters style and determines how they win the fights so understanding what stance allows you to win helps us answer the question of whether styles make fights.
I hypothesize that those fighting out of the switch stance will be more likely to have victories by KO.
I hypothesize that Orthodox fighters will be more likely to win via Dec or SUB
The lowest probability group is be match ups including a switch hitter. This is likely due to the difficulty of mastering both the orthodox and southpaw stance.
Switch hitting also isn’t optimal to MMA unless you have a certain build and it sacrifices takedown ability. Thus, I hypothesize switch hitters will have above average reach and height making them more rare since its a style enabled by ones physical build.
Note that the echo = FALSE
parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.