# install.packages("ggplot2") # run once manually if not installed
library(ggplot2)
data <- read.csv("DodgersData.csv")
Mean <- mean(data$attend)
Median <- median(data$attend)
Mean
## [1] 41040.07
Median
## [1] 40284
The mean attendance is about 41,040 and the median is 40,284. I would use the median because it is not affected by unusually high or low attendance games, so it better represents a typical game. The two values are close, so the data is fairly symmetric.
ggplot(data, aes(x = attend)) +
geom_histogram(binwidth = 5000, fill = "blue", color = "white") +
geom_vline(xintercept = Mean, color = "red", linetype = "dashed") +
labs(title = "Dodgers Home Game Attendance",
x = "Attendance",
y = "Number of Games")
Most Dodgers home games drew between about 30,000 and 45,000 fans, centered near 40,000. A few high-attendance games pull the distribution out toward 56,000.