home_game_25 <- dodgers_data[25, c(“temp”, “attend”, “opponent”)]
print(home_game_25) # Calculate median attendance median_attendance <- median(dodgers_data$“attend”, na.rm = TRUE)
print(“median_attend”) install.packages(“ggplot2”) # Load ggplot2 for visualization library(ggplot2)#library(car) # Package with Special functions for linear regression ggplot(dodgers_data, aes(x = bobblehead, y = attend)) + + geom_boxplot() + + labs(title = “Attend by bobblehead Type”, + x = “bobblehead Type”, + y = “Attend”) + + theme_minimal()
ggplot(dodgers_data, aes(x = temp, y = attend)) + geom_point() +
labs(title = “Attend vs. Temp”, x = “Temp (°F)”, y = “Attend”) +
theme_minimal() #Create A Boxplot ggplot(dodgers_data, aes(x =
bobblehead, y = attend)) + geom_boxplot() + labs(title = “Attend by
bobblehead Type”, x = “bobblehead Type”, y = “Attend”) + theme_minimal()
#Game 25 game_25 <- dodgers_data[25, c(“temp”, “attend”, “opponent”,
“bobblehead”)] > print(game_25) # A tibble: 1 × 4 temp attend
opponent bobblehead
1 61 36561 Astros NO
#Median median_attend <- median(dodgers_data$attend, na.rm = TRUE) print(median_attend) [1] 40284
#Night Games night_games <- sum(dodgers_data$day_night == “Night”, na.rm = TRUE) print(night_games) [1] 66