plotEducation <- function(education_age, education_race, education_sex) {
load("education_data.rda")
graph_data <-
education_data %>%
filter(Age_Group == education_age) %>%
filter(Race %in% education_race) %>%
filter(Sex %in% education_sex) %>%
filter(Education != "Missing/Unknown") %>%
mutate(Birth_Year = Year - 30) %>%
mutate(Population = ifelse(!is.na(CPS_Population), CPS_Population,
Census_Population)) %>%
group_by(Birth_Year, Education) %>%
summarise(Population = sum(Population))
graph_data %>%
ggplot(aes(Birth_Year, Population)) +
geom_area(aes(fill = Education), position = "fill") +
theme_minimal() +
xlab("Birth Year") +
ylab("Proportion") +
theme(legend.position = "none", legend.title = element_blank())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.