Total Fertility Rate

library(tidyverse)
load("/cloud/project/Nat0718.Rdata")

Get Rate by Race, Year and Age

RaceYrAge = Nat0718 %>%
  group_by(Race,yr,Age) %>%
  summarize(Births = sum(Births),
            Fpop = sum(Fpop) ) %>%
  mutate(Rate = Births/Fpop)
#View(RaceYrAge)

Get TFR by Race and Year

RaceYear = RaceYrAge %>%
  group_by(Race, yr) %>%
  summarize(TFR = sum(Rate)*5) %>%
  ungroup()

Plot

RaceYear %>%
  ggplot(aes(x=yr,y=TFR,color = Race)) +
  geom_point()