Compensation of employees by NUTS 2 regions - nama_10r_2coe

Data - Eurostat

currency

Code
nama_10r_2coe %>%
  left_join(currency, by = "currency") %>%
  group_by(currency, Currency) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) print_table(.) else .}
currency Currency Nobs
MIO_EUR Million euro 135488
MIO_NAC Million units of national currency 135488

nace_r2

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

geo

Code
nama_10r_2coe %>%
  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
nama_10r_2coe %>%
  group_by(time) %>%
  summarise(Nobs = n()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Table

Code
nama_10r_2coe %>%
  filter(time == "2015", 
         nchar(geo) == 4,
         currency == "MIO_EUR",
         nace_r2 == "TOTAL") %>%
  select(geo, value_added = values) %>%
  full_join(nama_10r_3empers %>%
              filter(time == "2015",
                     nchar(geo) == 4,
                     wstatus == "EMP",
                     nace_r2 == "TOTAL") %>%
              select(geo, employment = values), by = "geo") %>%
  mutate(emp_person = round(1000*value_added / employment)) %>%
  left_join(geo, by = "geo") %>%
  select(geo, Geo, emp_person) %>%
  na.omit %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Maps

Code
nama_10r_2coe %>%
  filter(time == "2015", 
         nchar(geo) == 4,
         currency == "MIO_EUR",
         nace_r2 == "C") %>%
  select(geo, value_added = values) %>%
  full_join(nama_10r_3empers %>%
              filter(time == "2015",
                     nchar(geo) == 4,
                     wstatus == "EMP",
                     nace_r2 == "TOTAL") %>%
              select(geo, employment = values), 
            by = "geo") %>%
  mutate(value = round(1000*value_added / employment)) %>%
  left_join(geo, by = "geo") %>%
  select(geo, Geo, value) %>%
  right_join(europe_NUTS2, by = "geo") %>%
  filter(long >= -15, lat >= 33, value <= 80000) %>%
  ggplot(., aes(x = long, y = lat, group = group, fill = value/1000)) +
  geom_polygon() + coord_map() +
  scale_fill_viridis_c(na.value = "white",
                       labels = scales::dollar_format(accuracy = 1, prefix = "", suffix = " k€"),
                       breaks = c(seq(0, 80, 2), 100, 200),
                       values = c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 1)) +
  theme_void() + theme(legend.position = c(0.25, 0.85)) + 
  labs(fill = "Compensation / Person")