#' plotMortality
#'
#' @return
#' @export
#'
#' @examples
#'
#' @import dplyr
plotMortality <- function(mortality_age, mortality_race, mortality_sex) {
load("mortality_data.rda")
graph_data <-
mortality_data %>%
filter(Race %in% mortality_race) %>%
filter(Sex %in% mortality_sex) %>%
filter(Age_Group %in% mortality_age) %>%
group_by(Year, Age_Group) %>%
summarise(Rate = mean(Rate))
graph_data %>%
ggplot(aes(Year, Rate)) +
geom_area(aes(fill = Age_Group), position = "fill") +
theme_minimal() +
xlab("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.