Emigration by age and sex - migr_emi2

Data - Eurostat

age

Code
migr_emi2 %>%
  left_join(age, by = "age") %>%
  group_by(age, Age) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

agedef

Code
migr_emi2 %>%
  left_join(agedef, by = "agedef") %>%
  group_by(agedef, Agedef) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) print_table(.) else .}
agedef Agedef Nobs
REACH Age reached during the year 135806
COMPLET Age in completed years 125436

unit

Code
migr_emi2 %>%
  left_join(unit, by = "unit") %>%
  group_by(unit, Unit) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

sex

Code
migr_emi2 %>%
  left_join(sex, by = "sex") %>%
  group_by(sex, Sex) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) print_table(.) else .}
sex Sex Nobs
T Total 92289
F Females 84480
M Males 84473

geo

Code
migr_emi2 %>%
  left_join(geo, by = "geo") %>%
  group_by(geo, Geo) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

time

Code
migr_emi2 %>%
  group_by(time) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Greece

Code
migr_emi2 %>%
  filter(geo == "EL",
         agedef == "COMPLET",
         sex == "T",
         time %in% c("2008", "2013", 2018),
         substr(age, 1, 1) == "Y") %>%
  select(age, time, values) %>%
  mutate(age = gsub("Y", "", age) %>% as.numeric) %>%
  ggplot + geom_line(aes(x = age, y = values, color = time, linetype = time)) +
  scale_color_manual(values = viridis(4)[1:3]) + theme_minimal() +
  theme(legend.position = c(0.8, 0.85),
        legend.title = element_blank()) +
  xlab("âge") + ylab("Emigration depuis la Grèce") +
  scale_y_continuous(breaks = seq(0, 20000, 1000)) +
  scale_x_continuous(breaks = seq(0, 100, 10))