Plotting Views on Immigration in Europe

Dependent variable: Is [country] made a worse or a better place to live by people coming to live here from other countries?
Countries: France, Germany, Spain, and Italy.

Overview | Immigration ~ Ideology | Immigration ~ Education | Immigration ~ Age

Script

fr = ess %>% filter(cntry == "FR") %>% mutate(country = "France")
es = ess %>% filter(cntry == "ES") %>% mutate(country = "Spain")
de = ess %>% filter(cntry == "DE") %>% mutate(country = "Germany")
it = ess %>% filter(cntry == "IT") %>% mutate(country = "Italy")
all = rbind(fr,es,de,it)
all = all %>% select(country, imwbcnt, lrscale, agea, eduyrs, cntry)
all = all %>% filter(eduyrs <= 27)

#overview
library("patchwork")
all %>% ggplot(., aes(x= imwbcnt, y = 1, col = country)) + 
  geom_jitter(alpha = .13) + 
  scale_x_continuous(limits = c(0, 10), breaks = c(0,1,2,3,4,5,6,7,8,9,10)) + 
  theme_minimal() + 
  theme(legend.position = "none") + 
  theme(axis.text.y = element_blank()) +
  theme(text=element_text(size = 20, family="saira")) +
  labs(x = "<-- Worse | Better -->", y = "", title = "Immigrants Make Country Worse or Better Place to Live?", subtitle = "France, Germany, Spain, and Italy", caption = "@JihedNcib | Data: ESS 2018") +
  geom_vline(data=filter(all, cntry=="FR"), aes(xintercept=5.03), linetype = "dashed") +
  geom_vline(data=filter(all, cntry=="IT"), aes(xintercept=4.11), linetype = "dashed") +
  geom_vline(data=filter(all, cntry=="DE"), aes(xintercept=5.35), linetype = "dashed") +
  geom_vline(data=filter(all, cntry=="ES"), aes(xintercept=5.65), linetype = "dashed") +
  facet_wrap(~country)

#ideology
library("jtools")
all %>% ggplot(., aes(x=lrscale, y=imwbcnt, col = country)) +
  geom_smooth(method=lm) +
  theme_minimal() + 
  theme(axis.text.y = element_blank()) +
  scale_x_continuous(limits = c(0, 10), breaks = c(0,1,2,3,4,5,6,7,8,9,10)) + 
  theme(legend.position = "bottom") + 
  theme(text=element_text(size = 20, family="saira")) +
  labs(x = "<-- Left | Right -->", y = "<-- Less in Favour | More in Favour -->", title = "Immigration ~ Ideology", subtitle = "France, Germany, Spain, and Italy", caption = "@JihedNcib | Data: ESS 2018")

#age and education
all %>% filter(agea >= 20) %>% ggplot(., aes(x=agea, y=imwbcnt, col = country)) +
  geom_smooth(method=lm) +
  theme_minimal() + 
  theme(axis.text.y = element_blank()) +
  theme(legend.position = "bottom") + 
  theme(text=element_text(size = 20, family="saira")) +
  labs(x = "- Age +", y = "<-- Less in Favour | More in Favour -->", title = "Immigration ~ Age", subtitle = "France, Germany, Spain, and Italy", caption = "@JihedNcib | Data: ESS 2018")
all %>% filter(agea >= 20) %>% ggplot(., aes(x=eduyrs, y=imwbcnt, col = country)) +
  geom_smooth(method=lm) +
  theme_minimal() + 
  theme(axis.text.y = element_blank()) +
  theme(legend.position = "bottom") + 
  theme(text=element_text(size = 20, family="saira")) +
  labs(x = "- Education +", y = "<-- Less in Favour | More in Favour -->", title = "Immigration ~ Education", subtitle = "France, Germany, Spain, and Italy", caption = "@JihedNcib | Data: ESS 2018")

(Vlines = Country mean)