R Markdown

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:

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")
summary(subset(UFC_Dataset, Gender == "MALE")$BlueAvgSigStrLanded)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00    4.17   17.25   21.58   34.27  154.00     819

The data above and below summarize the number of significant strikes landed per minute by each fighter. This data will help us understand what a high volume of strikes landed truly is.

Question: How many strikes must a fighter land per minute to have a significant impact on their chances of winning?

summary(subset(UFC_Dataset, Gender == "MALE")$RedAvgSigStrLanded)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00    4.52   21.00   22.87   35.78  141.00     394
UFC_Dataset |> 
  filter(Gender == "MALE") |>
  group_by(BlueStance) |>
  summarize (count = n())
## # A tibble: 5 × 2
##   BlueStance  count
##   <chr>       <int>
## 1 Open Stance     1
## 2 Orthodox     3863
## 3 Southpaw     1109
## 4 Switch        340
## 5 <NA>            2

The data above and below is a count of how many fighters fight out of each stance. Each stance has its pros and cons and heavily influences the style of a fighter.

Question: Do certain stances have a greater chance of winning against another specific stance?

UFC_Dataset |> 
  filter(Gender == "MALE") |>
  group_by(RedStance) |>
  summarize (count = n())
## # A tibble: 4 × 2
##   RedStance   count
##   <chr>       <int>
## 1 Open Stance     4
## 2 Orthodox     3913
## 3 Southpaw     1113
## 4 Switch        285
aggregate(BlueAvgSigStrLanded ~ BlueStance,
                        data = UFC_Dataset,
                        FUN = mean)
##    BlueStance BlueAvgSigStrLanded
## 1 Open Stance            31.14290
## 2    Orthodox            22.13315
## 3    Southpaw            21.19799
## 4      Switch            13.10730
avg_strikes_by_stance <- UFC_Dataset |>
  group_by(BlueStance) |>
  summarize(BlueAvgSigStrLanded = mean(BlueAvgSigStrLanded, na.rm = TRUE))
  #Define the variable the graph below will be using 

Using the aggregate function, I have now shown which stances are more likely to land strikes at a high volume. This will help us understand the styles behind each stance.

Question: Does stance have a significant influence in a fighters ability to land strikes? Does one stance have an advantage in striking? I will run the same aggregate function to determine whether or not stances effect ground game as well.

Including Plots

You can also embed plots, for example:

ggplot(avg_strikes_by_stance, aes(x = BlueStance, y = BlueAvgSigStrLanded)) +
  geom_bar(stat = "identity", fill = "blue") + 
  labs(title = "Average Significant Strikes by Stance", 
       x = "Stance", 
       y = "Average Significant Strikes Landed") +  
  theme_minimal()  

Here i visualize the data that I got from aggregate function above. This visualizes how the open stance seems to land more strikes. This suggests that we should look into a trend with the open stance and victory. I would like some feedback on this, I had outside resources help with this and I don’t fully understand the use of the stat = “identity” part of this. Also, how does it know to not count each stance and instead display the average from the aggregate function we used earlier?