library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.0 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.1 ✔ tibble 3.1.8
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the ]8;;http://conflicted.r-lib.org/conflicted package]8;; to force all conflicts to become errors
library(janitor)
##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(ggplot2)
march_madness_rebounds_data <- read_excel("march madness rebounds data.xlsx") %>%
clean_names()
march_madness_rebounds_data
## # A tibble: 340 × 8
## team year off_rebounds x3_poi…¹ assists turno…² made_…³ won_c…⁴
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr>
## 1 Akron 2022 330 0.318 396 396 No No
## 2 Alabama 2022 432 0.309 467 467 No No
## 3 Arizona 2022 388 0.356 677 449 No No
## 4 Arkansas 2022 363 0.3 462 429 Yes No
## 5 Auburn 2022 416 0.32 480 384 No No
## 6 Baylor 2022 416 0.304 512 416 No No
## 7 Boise St. 2022 340 0.333 408 408 No No
## 8 Bryant 2022 403 0.296 434 434 No No
## 9 Cal St. Fullerton 2022 310 0.312 341 372 No No
## 10 Chattanooga 2022 374 0.348 442 374 No No
## # … with 330 more rows, and abbreviated variable names ¹x3_point_percent,
## # ²turnovers, ³made_elite_8, ⁴won_championship
ggplot(march_madness_rebounds_data, aes(x = off_rebounds, y = x3_point_percent, shape = made_elite_8, color = won_championship)) + geom_point() +
facet_wrap(~ year) +
labs(title = "March Madness Teams and Their 3 Point % and Offensive Rebounds",
x = "Offensive Rebounds", y = "3 Point Percentage", color = "Championship Winner", shape = "Elite 8")

mme8 <- march_madness_rebounds_data %>%
filter(made_elite_8 == "Yes")
mme8
## # A tibble: 40 × 8
## team year off_rebounds x3_point_…¹ assists turno…² made_…³ won_c…⁴
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr>
## 1 Arkansas 2022 363 0.3 462 429 Yes No
## 2 Duke 2022 374 0.364 578 340 Yes No
## 3 Houston 2022 442 0.348 578 374 Yes No
## 4 Kansas 2022 377 0.353 524 425 Yes Yes
## 5 Miami FL 2022 264 0.35 462 330 Yes No
## 6 North Carolina 2022 363 0.364 495 396 Yes No
## 7 Saint Peter 2022 330 0.312 360 420 Yes No
## 8 Villanova 2022 330 0.36 396 330 Yes No
## 9 Arkansas 2021 334 0.339 419 368 Yes No
## 10 Baylor 2021 309 0.418 409 298 Yes Yes
## # … with 30 more rows, and abbreviated variable names ¹x3_point_percent,
## # ²turnovers, ³made_elite_8, ⁴won_championship
ggplot(mme8, aes(x = off_rebounds, y = x3_point_percent, color = won_championship, shape = won_championship)) +
geom_point() +
#facet_wrap(~ year) +
labs(title = "March Madness Elite 8 and Their 3 Point % and Offensive Rebounds",
x = "Offensive Rebounds", y = "3 Point Percentage", color = "Championship Winner") +
guides(shape = "none")

ggplot(march_madness_rebounds_data, aes(x = off_rebounds, y = x3_point_percent, size = made_elite_8, color = won_championship)) + geom_point() +
labs(title = "March Madness Teams and Their 3 Point % and Offensive Rebounds",
x = "Offensive Rebounds", y = "3 Point Percentage", color = "Championship Winner", size = "Elite 8")
## Warning: Using size for a discrete variable is not advised.

ggplot(march_madness_rebounds_data, aes(x = assists, y = turnovers, shape = made_elite_8, color = won_championship)) + geom_point() +
facet_wrap(~ year) +
labs(title = "March Madness Teams and Their Turnovers and Assists",
x = "Assists", y = "Turnovers", color = "Championship Winner", shape = "Elite 8")

ggplot(mme8, aes(x = assists, y = turnovers, color = won_championship)) + geom_point() +
facet_wrap(~ year) +
labs(title = "Elite 8 Teams and Their Turnovers and Assists",
x = "Assists", y = "Turnovers", color = "Championship Winner")

ggplot(march_madness_rebounds_data, aes(x = assists, y = off_rebounds, size = made_elite_8, color = won_championship)) + geom_point() +
#facet_wrap(~ year) +
labs(title = "March Madness Teams and Their Offensive Rebounds and Assists",
x = "Assists", y = "Offensive Rebounds", color = "Championship Winner", shape = "Elite 8")
## Warning: Using size for a discrete variable is not advised.

ggplot(mme8, aes(x = assists, y = off_rebounds, color = won_championship)) + geom_point() +
facet_wrap(~ year) +
labs(title = "Elite 8 Teams and Their Offensive Rebounds and Assists",
x = "Assists", y = "Offensive Rebounds", color = "Championship Winner")
