Median saving rate by educational attainment level of the reference person - experimental statistics - icw_sr_04

Data - Eurostat

isced11

Code
icw_sr_04 %>%
  left_join(isced11, by = "isced11") %>%
  group_by(isced11, Isced11) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()
isced11 Isced11 Nobs
ED2 Lower secondary education 84
ED3 Upper secondary education 84
ED6-8 Tertiary education excluding short-cycle tertiary education (levels 6-8) 84
TOTAL All ISCED 2011 levels 84
ED0-2 Less than primary, primary and lower secondary education (levels 0-2) 83
ED3_4 Upper secondary and post-secondary non-tertiary education (levels 3 and 4) 83
ED5-8 Tertiary education (levels 5-8) 83
ED5 Short-cycle tertiary education 79
ED1 Primary education 78
ED4 Post-secondary non-tertiary education 76
UNK Unknown 62
ED0 Early childhood education 61

unit

Code
icw_sr_04 %>%
  left_join(unit, by = "unit") %>%
  group_by(unit, Unit) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()
unit Unit Nobs
PC_DI Percentage of disposable income 941

geo

Code
icw_sr_04 %>%
  left_join(geo, by = "geo") %>%
  group_by(geo, Geo) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  mutate(Geo = ifelse(geo == "DE", "Germany", Geo)) %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(Geo)),
         Flag = paste0('<img src="../../bib/flags/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

time

Code
icw_sr_04 %>%
  group_by(time) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional()
time Nobs
2015 347
2010 302
2020 292

Tables

2010

Code
icw_sr_04 %>%
  filter(time == "2010") %>%
  select(isced11, geo, values) %>%
  left_join(geo, by = "geo") %>%
  spread(isced11, values) %>%
  select(geo, Geo, TOTAL, everything()) %>%
  mutate(Geo = ifelse(geo == "DE", "Germany", Geo)) %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(Geo)),
         Flag = paste0('<img src="../../bib/flags/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  arrange(-`TOTAL`) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

2015

Code
icw_sr_04 %>%
  filter(time == "2015") %>%
  select(isced11, geo, values) %>%
  left_join(geo, by = "geo") %>%
  spread(isced11, values) %>%
  select(geo, Geo, TOTAL, everything()) %>%
  mutate(Geo = ifelse(geo == "DE", "Germany", Geo)) %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(Geo)),
         Flag = paste0('<img src="../../bib/flags/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  arrange(-`TOTAL`) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Germany, France, Sweden

Code
icw_sr_04 %>%
  filter(time == "2015",
         geo %in% c("SE", "FR", "DE"),
         grepl("ED", isced11)) %>%
  left_join(geo, by = "geo") %>%
  left_join(colors, by = c("Geo" = "country")) %>%
  mutate(values = values/100) %>%
  ggplot + geom_line(aes(x = isced11, y = values, color = color, group = color)) +
  scale_color_identity() + theme_minimal() +
  geom_image(data = . %>%
               group_by(isced11) %>%
               filter(n() == 3) %>%
               arrange(values) %>%
               mutate(dist = min(values[2]-values[1],values[3]-values[2],values[4]-values[3])) %>%
               arrange(-dist, isced11) %>%
               head(3) %>%
               mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Geo)), ".png")),
             aes(x = isced11, y = values, image = image), asp = 1.5) +
  xlab("Education") + ylab("Taux d'épargne médian par niveau d'éducation") +
  scale_y_continuous(breaks = 0.01*seq(-30, 50, 5),
                     labels = percent_format(accuracy = 1))