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
names(dodgers)
##  [1] "month"       "day"         "attend"      "day_of_week" "opponent"   
##  [6] "temp"        "skies"       "day_night"   "cap"         "shirt"      
## [11] "fireworks"   "bobblehead"

#Calculate Mean and Median attendance

mean_attendance <- mean(dodgers$attend)
median_attendance <- median(dodgers$attend)

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

#Question 1: The median attendance was 40,284, and the mean attendance was 41,040.07. I would use the median for interpretation because it represents the middle game attendance and is less affected by unusually high or low attendance values.

library(ggplot2)

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

#Question 2: The graph shows the attendance levels for Dodgers games. Most games had attendance between approximately 30,000 and 50,000 people, while fewer games had extremely low or extremely high attendance.

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

#Question 3: The scatterplot compares temperature with Dodgers game attendance. The points are spread out, so there does not appear to be a strong relationship between temperature and attendance.