## ----warning = FALSE, message = FALSE, echo = TRUE-----------------------
library(wicher)
library(tidyverse)
head(wiche_enrollments)
## ----fig.width = 7, fig.height = 4, echo = TRUE--------------------------
library(ggplot2)
enrollments <-
wiche_enrollments %>%
filter(year %in% 2000:2010,
location %in% "ca",
race %in% c("white", "hispanic"),
grade == "g") %>%
arrange(year, race)
qplot(year, n, data = enrollments,
color = race,
geom = c("point", "smooth"),
main = "California Enrollment",
xlab = "Academic Year",
ylab = "Enrollment")
## ----fig.width = 7, fig.height = 4, echo = TRUE--------------------------
ggplot(enrollments, aes(x = as.character(year), y = n, group = race)) +
geom_smooth(aes(color = race)) +
geom_point(aes(color = race)) +
ggtitle("California Enrollment") +
labs(x = "Academic Year", y = "Enrollment")
## ----fig.width = 7, fig.height = 4, echo = TRUE--------------------------
enrollments <-
wiche_enrollments %>%
filter(year %in% 2005,
location %in% "ca",
race %in% c("white", "asian", "hispanic", "native", "black"),
grade == "g") %>%
arrange(year, race)
ggplot(data = enrollments, aes(race, n)) +
geom_bar(stat = "identity", position = "dodge") +
ggtitle("California Enrollment (2005)") +
labs(x = "Academic Year", y = "Enrollment")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.