library(dplyr)
library(assertr)
library(tidyr)
pxweb_nonbirths <- readRDS("data-raw/pxweb_nonbirths.rds")
head <- pxweb_nonbirths %>%
filter(event == "Population (start of year)") %>%
filter(time == min(time)) %>%
mutate(time = time - 1L) ## convert to end of year
tail <- pxweb_nonbirths %>%
filter(event == "Population (end of year)")
gl_reg_popn <- bind_rows(head, tail) %>%
filter(time >= cohort) %>%
mutate(age = time - cohort) %>%
verify(!is.na(age) & age >= 0) %>%
count(age, gender, time, wt = count, name = "count")
save(gl_reg_popn,
file = "data/gl_reg_popn.rda",
compress = "xz")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.