Pair programming partner: (Gian Abundo, Victor Cervantes)
The ggplot2 package was installed manually (run once in the Console, not while knitting):
install.packages("ggplot2")
library(ggplot2)
data <- read.csv("DodgersData.csv")
# Put days of the week in calendar order for the graph
data$day_of_week <- factor(data$day_of_week,
levels = c("Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday"))
summary(data$attend)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 24312 34493 40284 41040 46588 56000
Mean <- mean(data$attend)
Median <- median(data$attend)
Mean
## [1] 41040.07
Median
## [1] 40284
ggplot(data, aes(x = attend, fill = bobblehead)) +
geom_histogram(bins = 30, col = "white") +
scale_fill_manual(values = c("lightblue", "blue")) +
ggtitle("Frequency of Attendance - Bobblehead vs. No Bobblehead")
library(ggplot2)
# Wait for the magic to happen
ggplot(data, aes(x=bobblehead, y=attend, fill=bobblehead))+
geom_boxplot(outlier.shape = NA, alpha=.5) +
geom_jitter(width=.1, size=1) +
theme_classic() +
scale_fill_manual(values=c("blue","lightblue"))