pwt91 %>%
filter(year(date) == 2014,
variable %in% c("cgdpo", "pop")) %>%
left_join(iso2c, by = "iso3c") %>%
spread(variable, value) %>%
mutate(cgdpo_pop = cgdpo/pop) %>%
right_join(world, by = "iso2c") %>%
ggplot(aes(long, lat, group = group)) +
geom_polygon(aes(fill = cgdpo_pop),
colour = alpha("white", 1/2),
size = 0.1) +
scale_fill_viridis_c(labels = scales::dollar,
breaks = c(20000, 40000, 60000, 100000, 140000),
values = c(0, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 1)) +
theme_void() +
theme(legend.position = c(0.1, 0.4),
legend.title = element_blank())
pwt91 %>%
filter(variable == "rkna") %>%
left_join(iso3c, by = "iso3c") %>%
group_by(iso3c, iso3c_desc) %>%
summarise(`Year 1` = first(year(date)),
`Year 2` = last(year(date)),
`Value 1` = first(value) %>% round(., digits = 1),
`Value 2` = last(value) %>% round(., digits = 1)) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}
pwt91 %>%
filter(year(date) == "2014",
variable %in% c("cgdpo", "ck", "delta", "pop", "emp", "labsh")) %>%
select(iso3c, variable, value) %>%
spread(variable, value) %>%
left_join(iso3c, by = "iso3c") %>%
mutate(ck_gdp = ck / cgdpo,
cgdpo_pop = cgdpo/pop,
cgdpo_emp = cgdpo/emp,
ck_emp = ck/emp,
ret_gross = 100*(1-labsh)/ck_gdp,
delta = 100*delta,
ret_net = ret_gross - delta) %>%
select(iso3c, iso3c_desc, pop, cgdpo_pop, ck_gdp, ret_gross, delta, ret_net) %>%
# Advanced Economies
filter(cgdpo_pop >= 30000,
pop >= 1) %>%
mutate_at(vars(-iso3c, -iso3c_desc), funs(round(., digits = 2))) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}