# Perform left join using common iso3c variable and year
dem_women <- left_join(dem_data, women_emp, by = c("iso3c", "year")) |>
select(-c(country_text_id, country_id, country)) |> # drop extra country codes/names
rename(region = e_regionpol_6C,
polyarchy = v2x_polyarchy,
libdem = v2x_libdem) |>
mutate(
region = case_match(region, # replace the values in region with country names
1 ~ "Eastern Europe",
2 ~ "Latin America",
3 ~ "Middle East",
4 ~ "Africa",
5 ~ "The West",
6 ~ "Asia")
)
# View the data
glimpse(dem_women)