library(ggplot2)
data <- read.csv("DodgersData.csv")
head(data)
## 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
Mean <- mean(data$attend)
Median <- median(data$attend)
Mean
## [1] 41040.07
Median
## [1] 40284
The mean attendance is 41,040.07, while the median attendance is 40,284. I would use the median for interpretation because it better represents the typical attendance.
names(data)
## [1] "month" "day" "attend" "day_of_week" "opponent"
## [6] "temp" "skies" "day_night" "cap" "shirt"
## [11] "fireworks" "bobblehead"
ggplot(data, aes(x = month, y = attend)) +
geom_boxplot() +
labs(title = "Dodgers Attendance by Month",
x = "Month",
y = "Attendance")
The graph shows that Dodgers attendance depends on the month. June had the highest median attendance, while October had the lowest median attendance.