##Dodger Attendance Analysis
#Load the dataset
DodgersData <- read_csv("DodgersData.csv")
## Rows: 81 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): month, day_of_week, opponent, skies, day_night, cap, shirt, firewor...
## dbl (3): day, attend, temp
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Summary Statistics for Attendance
mean_attend <- mean(DodgersData$attend)
median_attend <- median(DodgersData$attend)
#Display calculated values
mean_attend
## [1] 41040.07
median_attend
## [1] 40284
##Attendance Distribution Plot
#Boxplot comparing attendance by day vs night games
ggplot(DodgersData, aes(x = day_night, y = attend, fill = day_night)) +
geom_boxplot() +
labs(
title = "Dodgers Attendance: Day vs. Night Games",
x = "Game Time",
y = "Attendance"
) +
theme_minimal()
library(ggplot2)
ggplot(DodgersData, aes(x = attend)) +
geom_histogram(
bins = 10,
fill = "red",
color = "white"
) +
labs(
title = "Distribution of Dodgers Attendance",
x = "Attendance",
y = "Number of Games"
) +
theme_minimal()