Load Libraries
library(tidyverse)
Get the Data
Nat0718 <- read_csv("Nat0718.csv")
## Parsed with column specification:
## cols(
## Region = col_character(),
## Race = col_character(),
## Age = col_character(),
## Year = col_double(),
## Births = col_character(),
## Fpop = col_character()
## )
Nat0718 %>%
mutate(Births = as.numeric(Births),
yr = Year %% 1000,
Fpop = as.numeric(Fpop),
Race = factor(Race),
Region = factor(Region),
Age = factor(Age)) %>%
na.omit() %>%
mutate(Race = recode(Race,'1002-5' = "AmInd",
'2054-5' = "Black",
'2106-3' = "White"),
Region = recode(Region,"CENS-R1" = "NE",
"CENS-R2" ="MW",
"CENS-R3" = "S",
"CENS-R4" = "W")) %>%
group_by(Region,Race,Age) %>%
mutate(Rate = Births/Fpop) %>%
ungroup() -> Nat0718
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
save(Nat0718,file = "Nat0718.Rdata")
Demo Graphic
Nat0718 %>%
ggplot(aes(x=yr,y=Rate,color=Race)) +
geom_point(size=.5) +
facet_grid(Age~Region)
