## Dataset
dodgers <- read.csv("DodgersData.csv")
head(dodgers)
##   month day attend day_of_week opponent temp  skies day_night cap shirt
## 1   APR  10  56000     Tuesday  Pirates   67 Clear        Day  NO    NO
## 2   APR  11  29729   Wednesday  Pirates   58 Cloudy     Night  NO    NO
## 3   APR  12  28328    Thursday  Pirates   57 Cloudy     Night  NO    NO
## 4   APR  13  31601      Friday   Padres   54 Cloudy     Night  NO    NO
## 5   APR  14  46549    Saturday   Padres   57 Cloudy     Night  NO    NO
## 6   APR  15  38359      Sunday   Padres   65 Clear        Day  NO    NO
##   fireworks bobblehead
## 1        NO         NO
## 2        NO         NO
## 3        NO         NO
## 4       YES         NO
## 5        NO         NO
## 6        NO         NO
## Question 1
median_attendance <- median(dodgers$attend)
mean_attendance <- mean(dodgers$attend)

median_attendance
## [1] 40284
mean_attendance
## [1] 41040.07

Question 2

library(ggplot2)

ggplot(dodgers, aes(x = attend)) +
geom_histogram(
bins = 10,
fill = "purple",
color = "white"
) +
labs(
title = "Distribution of Dodgers Attendance",
x = "Attendance",
y = "Number of Games"
) +
theme_minimal()

The graph shows that most Dodgers games had attendance between approximately 30,000 and 50,000 people. A few games had higher attendance, which helps explain why the mean is slightly higher than the median.

Extra graph

ggplot(dodgers, aes(x = temp, y = attend)) +
geom_point(color = "darkorange", size = 3) +
labs(
title = "Dodgers Attendance by Temperature",
x = "Temperature",
y = "Attendance"
) +
theme_minimal()