Code
%>%
yth_demo_030 left_join(unit, by = "unit") %>%
group_by(unit, Unit) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
if (is_html_output()) print_table(.) else .} {
unit | Unit | Nobs |
---|---|---|
AVG | Average | 2115 |
Data - Eurostat
%>%
yth_demo_030 left_join(unit, by = "unit") %>%
group_by(unit, Unit) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
if (is_html_output()) print_table(.) else .} {
unit | Unit | Nobs |
---|---|---|
AVG | Average | 2115 |
%>%
yth_demo_030 left_join(sex, by = "sex") %>%
group_by(sex, Sex) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
if (is_html_output()) print_table(.) else .} {
sex | Sex | Nobs |
---|---|---|
F | Females | 705 |
M | Males | 705 |
T | Total | 705 |
<- yth_demo_030 %>%
europe_NUTS0_new filter(sex == "T",
== "2018") %>%
time select(geo, values) %>%
right_join(europe_NUTS0 %>%
filter(long >= -10,
>= 20), by = "geo") %>%
lat group_by(geo, values) %>%
summarise(long = mean(long), lat = mean(lat))
%>%
yth_demo_030 filter(sex == "T",
== "2018") %>%
time select(geo, values) %>%
right_join(europe_NUTS0 %>%
filter(long >= -10,
>= 20), by = "geo") %>%
lat ggplot(aes(x = long, y = lat)) +
geom_polygon(aes(group = group, fill = values)) + coord_map() +
scale_fill_viridis_c(na.value = "white",
labels = dollar_format(a = 1, p = "", su = ""),
breaks = seq(0, 80, 2)) +
geom_text(aes(label = values), data = europe_NUTS0_new, size = 3, hjust = 0.5) +
theme_void() + theme(legend.position = c(0.25, 0.85)) +
labs(fill = "Average age of young people \nleaving the parental household")
<- yth_demo_030 %>%
europe_NUTS0_new filter(sex == "T") %>%
mutate(year = as.integer(time)) %>%
select(geo, year, values) %>%
right_join(europe_NUTS0 %>%
filter(long >= -10,
>= 20), by = "geo") %>%
lat group_by(geo, year, values) %>%
summarise(long = mean(long), lat = mean(lat))
options(gganimate.nframes = 50, gganimate.end_pause = 10)
%>%
yth_demo_030 filter(sex == "T") %>%
mutate(year = as.integer(time)) %>%
select(year, geo, values) %>%
left_join(europe_NUTS0 %>%
filter(long >= -10,
>= 20), by = "geo") %>%
lat arrange(year) %>%
%>%
na.omit ggplot(aes(x = long, y = lat)) +
geom_polygon(aes(group = group, fill = values)) + coord_map() +
scale_fill_viridis_c(na.value = "white",
labels = dollar_format(a = 1, p = "", su = ""),
breaks = seq(0, 80, 2)) +
theme_void() + theme(legend.position = c(0.25, 0.85)) +
labs(fill = "Average age of young people \nleaving the parental household") +
if(!is_latex_output())transition_time(year)} +
{if(!is_latex_output())labs(title = "Year: {frame_time}")} {