Code
library(conflicted)
library(tidyverse)
conflicts_prefer(dplyr::filter, .quiet = TRUE)
library(knitr)
library(reactable)
Information on ESS party IDs from “party-voted-for” (prtc*) and “party-close-to” (prtc*) questions – see also section “ESS party data structure” in manuscript.
library(conflicted)
library(tidyverse)
conflicts_prefer(dplyr::filter, .quiet = TRUE)
library(knitr)
library(reactable)
# ESS datasets in rds and with selected variables created in "01-ess-prt.R"
<- read_rds("data/ess-waves/ESS9e03_1.rds")
ess9_raw <- read_rds("data/02-ess-select.rds")
ess_raw
# long format ESS prt* variables
<- read_rds("data/01-ess-prt.rds")
prt_raw
# prtv* (single per country) and prtc* ESS variable with ESS numeric ID
<- read_rds("data/01-ess-prtv-prtc.rds") prtvc_raw
All ESS rounds include two types of survey questions with party information.
|>
ess_raw summarise(
n = n(),
n_countries = n_distinct(cntry),
n_prtv = n_distinct(prtv),
n_prtc = n_distinct(prtc),
.by = "essround"
|>
) arrange(essround)
essround | n | n_countries | n_prtv | n_prtc |
---|---|---|---|---|
1 | 42359 | 22 | 251 | 248 |
2 | 47537 | 25 | 281 | 274 |
3 | 43000 | 23 | 248 | 251 |
4 | 56752 | 29 | 309 | 296 |
5 | 52458 | 27 | 321 | 302 |
6 | 54673 | 29 | 331 | 331 |
7 | 40185 | 21 | 258 | 252 |
8 | 44387 | 23 | 283 | 271 |
9 | 49519 | 29 | 363 | 374 |
10 | 58810 | 30 | 380 | 390 |
We use the ESS-9 integrated file to describe the structure of the prt* variables in ESS data files.
Each ESS round uses country level variables for the prt* variables (e.g. prtvtcat — party-voted-for Austria ESS-9).
These prt* variables include the following elements:
<-
ess9_prt |>
ess9_raw select(cntry, starts_with(c("prtv", "prtc"))) |>
pivot_longer(!cntry, names_to = "variable", values_to = "party") |>
na.omit()
<-
ess9_prt_n |>
ess9_prt summarise(
cntry = first(cntry),
responses = n(),
parties = paste(unique(party) |> as.character() |> sort(), collapse = ", "),
.by = c(cntry, variable)
)
ESS-9 prt* variables by country
<-
tbl_out |>
ess9_prt_n summarise(
n = n(),
variables = paste(variable |> sort(), collapse = ", "),
.by = cntry
)
if (knitr::is_html_output()) {
|>
tbl_out reactable(searchable = TRUE, striped = TRUE)
else {
} |>
tbl_out slice((1:5))
}
Germany and Lithuania include multiple prtv* variables asking for voting decisions in each electoral tier. These variables include a number for the tier in the variable name.
We use the national tier (“prtvede2”, “prtvblt1”) as the primary “party-voted-for” variable.
|>
ess9_prt filter(str_detect(variable, "\\d")) |>
distinct(cntry, variable) |>
arrange(cntry, variable)
cntry | variable |
---|---|
DE | prtvede1 |
DE | prtvede2 |
LT | prtvblt1 |
LT | prtvblt2 |
LT | prtvblt3 |
ESS may use different IDs across ESS rounds
<-
prtv_ids |>
prt_raw mutate(party = as.character(party)) |>
filter(
str_detect(variable, "^prtv"), # party-voted-for variable
!str_detect(variable, "de1|lt[23]") # national vote only DEU and LTU
|>
) select(-idno, -variable, -ess_id) |>
distinct() |>
arrange(party_id) |>
pivot_wider(
names_from = party_id,
values_from = party,
names_prefix = "id_"
|>
) arrange(cntry, essround)
e.g. Netherlands prtv* rounds 1–10
|>
prtv_ids filter(cntry == "NL") |>
select(essround, id_4:id_6)
essround | id_4 | id_5 | id_6 |
---|---|---|---|
1 | List Pim Fortuyn | Democrats ’66 | Green Left |
2 | List Pim Fortuyn | Democrats ’66 | Green Left |
3 | List Pim Fortuyn | Democrats ’66 | Green Left |
4 | List Pim Fortuyn | Democrats ’66 | Green Left |
5 | Christian Democratic Appeal | Socialist Party | Democrats ’66 |
6 | Christian Democratic Appeal | Socialist Party | Democrats ’66 |
7 | Socialist Party | Christian Democratic Appeal | Democrats ’66 |
8 | Socialist Party | Christian Democratic Appeal | Democrats ’66 |
9 | Socialist Party | Christian Democratic Appeal | Democrats ’66 |
10 | Socialist Party | Christian Democratic Appeal | Democrats ’66 |
ESS party IDs may differ between the prtv* and prtc* variables.
<-
tbl |>
prtvc_raw mutate(
prtv_party_id = str_extract(prtv, "\\d+-\\d+") |> str_remove("\\d+-") |> as.integer(),
prtc_party_id = str_extract(prtc, "\\d+-\\d+") |> str_remove("\\d+-") |> as.integer()
|>
) filter(prtv_party_id == prtc_party_id & prtv_party != prtc_party) |>
select(cntry, essround, party_id = prtv_party_id, prtv_party, prtc_party) |>
distinct() |>
arrange(essround, cntry, prtv_party)
Examples from six countries in ESS-9
|>
tbl filter(essround == 9) |>
slice(2, 5, 18, 27, 29, 38)
cntry | essround | party_id | prtv_party | prtc_party |
---|---|---|---|---|
BG | 9 | 2 | Balgarska sotsialisticheska partiya (BSP) | Dvizhenie za prava i svobodi (DPS) |
FI | 9 | 10 | Green League | Independence Party |
LT | 9 | 2 | Homeland Union - Lithuanian Christian Democrats (TS-LKD) | Lithuanian Peasant and Greens Union (LVZS) |
PL | 9 | 3 | Nowoczesna | Platforma Obywatelska |
PT | 9 | 17 | Votou em branco/ nulo | CDS-PP |
SK | 9 | 5 | ĽS Naše Slovensko | Christian Democratic Movement (KDH) |
<-
tbl_v |>
prtvc_raw filter(str_detect(prtv, "FI-(8|9|10)-10-v")) |>
distinct(essround, prtv, prtv_party)
<-
tbl_c |>
prtvc_raw filter(str_detect(prtc, "FI-(8|9|10)-10-c")) |>
distinct(essround, prtc, prtc_party)
<-
tbl_out |>
tbl_v left_join(tbl_c)
write_csv(tbl_out, "figures-tables/table-1_ess-incoherence.csv")