cdc_cols <- cols(
Notes = col_skip(),
`Age Group` = col_character(),
`Age Group Code` = col_skip(),
Gender = col_character(),
`Gender Code` = col_skip(),
Race = col_character(),
`Race Code` = col_skip(),
Year = col_integer(),
`Year Code` = col_skip(),
Deaths = col_integer(),
Population = col_integer(),
`Crude Rate` = col_skip()
)
cdc_1968 <- read_tsv("inst/extdata/Compressed Mortality, 1968-1978.txt",
col_types = cdc_cols, n_max = 924, na = "Not Applicable")
cdc_1979 <- read_tsv("inst/extdata/Compressed Mortality, 1979-1998.txt",
col_types = cdc_cols, n_max = 1680, na = "Not Applicable")
cdc_1999 <- read_tsv("inst/extdata/Compressed Mortality, 1999-2015.txt",
col_types = cdc_cols, n_max = 1888, na = "Not Applicable")
cdc_data <-
full_join(cdc_1968, cdc_1979) %>%
full_join(cdc_1999) %>%
rename(Age_Group = `Age Group`) %>%
rename(Sex = Gender) %>%
mutate(Race = gsub("American Indian or Alaska Native", "Other Race",
Race)) %>%
mutate(Race = gsub("Asian or Pacific Islander", "Other Race", Race)) %>%
select(Year, Age_Group, Race, Sex, Deaths, Population)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.