Created
November 14, 2018 02:39
-
-
Save kippjohnson/bc76f5cd1f8af3d865355a292d5ed8f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(data.table) | |
library(ggplot2) | |
library(ggsci) | |
dat <- fread("~/Downloads/neoplasm_vs_circulatory_mortality_parsed.txt") | |
colnames(dat) <- c("V0", "Gender", "GenderCode", "CauseOfDeath", "ICD", "Year", "Year1", "Deaths", "Population", "CrudeRate","AgeAdjustedRate") | |
dat$Cause <- plyr::mapvalues(dat$CauseOfDeath, from=c("Diseases of the circulatory system","Neoplasms"), to=c("Circulatory\nSystem","Neoplasm")) | |
ggplot(dat, aes(x=Year, y=CrudeRate, color=Gender, linetype=Cause)) + | |
geom_line() + | |
theme_bw() + | |
scale_color_aaas() + | |
labs(x="Year", y="Death Rate", title="Crude Death Rate") | |
ggplot(dat, aes(x=Year, y=AgeAdjustedRate, color=Gender, linetype=Cause)) + | |
geom_line() + | |
theme_bw() + | |
scale_color_aaas() + | |
labs(x="Year", y="Death Rate", title="Age-adjusted Death Rate") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment