briatte / dsr

Introduction to Data Science with R (Sciences Po, Paris, 2023)
https://f.briatte.org/teaching/syllabus-dsr.pdf
44 stars 9 forks source link

Surveys - Solidarity in Europe (SiE) #38

Open briatte opened 1 year ago

briatte commented 1 year ago

https://twitter.com/alexandreafonso/status/1658451225174753280

https://europeangovernanceandpolitics.eui.eu/eui-yougov-solidarity-in-europe-project/ https://cadmus.eui.eu/handle/1814/72778

d <- "2020 SiE year dataset/2020 SiE dataset_dataset.csv" %>%
  readr::read_csv()

count(d, qcountry)
cty <- c("United Kingdom" ,"Denmark" ,"Finland" ,"France" ,"Germany" ,"Sweden" ,"Greece" ,"Hungary" ,"Italy" ,"Lithuania" ,"Netherlands" ,"Poland" ,"Romania" ,"Spain")
d$qcountry <- factor(d$qcountry, labels = cty)

summary(d$weight)

str_subset(names(d), "q20")
d <- mutate_at(d, vars(starts_with("q20")), ~ case_when(.x == 1 ~ 1L, .x == 2 ~ 0L, .x == 3 ~ NA_integer_))

# Austria
count(d, qcountry, q20_1)
tapply(d$q20_1, d$qcountry, mean, na.rm = TRUE)

# TODO: survey weights
# TODO: make dyadic version

Possibly present as a ‘freestyle’ exercise -- here's the data, do whatever you like with it. In this case, provide the data as a truly dyadic dataset, with q20_x merged into a single item, and additional columns corresponding to the model in the paper.