library(dplyr)
library(assertr)
pxweb_nonbirths <- readRDS("data-raw/pxweb_nonbirths.rds")
gl_reg_emig <- pxweb_nonbirths %>%
filter(event == "Emigration") %>%
mutate(age = time - cohort - (triangle == "Upper")) %>%
mutate(is_valid_age = !is.na(age) & (age >= 0)) %>%
verify(is_valid_age | (count == 0L)) %>%
filter(is_valid_age) %>%
filter(age <= max(age * (count > 0L))) %>%
count(cohort, age, gender, time, wt = count, name = "count")
save(gl_reg_emig,
file = "data/gl_reg_emig.rda",
compress = "xz")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.