Connecting The PopuList 2.0 to other databases
To explain the logic of the time varying The PopuList classifications and to show the potential of the new id-link from The PopuList to other political party databases (e.g. ParlGov, Manifesto Project, Party Facts), this post presents the code necessary to arrive at a simplified version of the stacked column plot shown on the home page and the explore the data page.
Visualizing the vote share of far-right, populist and far-right-populist parties in Poland
1. Loading packages and data
If any of the packages are not installed yet, first install them via e.g.
# Loading packages library('tidyverse') # for simple data wrangling library('rio') # for simple data importing
# Loading data # PopuList 2.0 populist <- import("https://populistorg.files.wordpress.com/2020/02/populist-2.0.xlsx") populist <- select(populist, populist:manifesto_id) # Here I remove the party and country names so as to avoid confusion in the linking step below (e.g. duplicated varable names). # ParlGov - Elections Dataset elections <- import("http://www.parlgov.org/static/data/development-utf-8/view_election.csv", encoding = "UTF-8")
2. Linking the datasets
As The PopuList 2.0 was developed in close connection to the ParlGov dataset, almost all The PopuList entries have a ParlGov id
"parlgov_id". An easy exercise is thus to link The PopuList to the election results reported in the ParlGov dataset (Döring and Manow, 2019).
# Link datasets elections_pop <- left_join(elections, populist, by=c("party_id"="parlgov_id"))
3. Sample Selection
Here I select a country, time and election type from the ParlGov entries.
(Note: The PopuList classifies parties which have won at least 1 seat or 2% of the votes in parliamentary elections in European countries since 1989)
In our case we look at Polish parliamentary elections since 1990.
elections_pop %>% filter(country_name=="Poland", election_date>1990, election_type=="parliament")
4. Account for time dynamic classification
The PopuList 2.0 classifies parties accross time and makes a distinction between clear cases and borderline cases (see the codebook for more information). At this step one could restrict the analysis to uncontested cases by adding ‘nobl’ to the time limitations (e.g. ‘farright_startnobl’). Most parties’ classifications don’t change accross time, for some cases this step may be skipped.
If other classifications (i.e.
eurosceptic) are relevant for your project, also include these here.
elections_pop %>% mutate( farright = ifelse(election_date >= farright_start & election_date <= populist_end, 1,0), )
5. Grouping Variable & Aggregation
Here the separate classification columns are aggregated to combinations to allow for an easy summing of vote-shares. To control for the order of these categories in the data visualization I save this variable as factor.
I also create a
year variable from the
elections_pop %>% mutate( # Create a Party Type variable including an 'other parties' category partytype = case_when( farright == 1 & populist == 1 ~ 3, # far-right populist farright == 1 ~ 4, # other far-right populist == 1 ~ 2, # other populist TRUE ~ 1, # other parties ), # To control order of categories partytype = partytype %>% factor(levels=1:4, labels=c("other parties", "other populist", "far-right populist", "other far-right" )), year = election_date %>% str_sub(1,4) ) %>% # Aggregate vote-shares by election date and partytype group_by(year, partytype) %>% summarise(votes = sum(vote_share, na.rm=T)) %>% # Kick out non-populist and non-far-right parties filter(!partytype=="other parties")
elections_pop %>% ggplot(aes(x=year, y=votes, group=partytype)) + # define overall parameters of visualization geom_col(aes(fill=partytype), width=1, alpha=0.8) + # add a column plot element scale_fill_manual(values=c("#EF475E","#506697","grey23")) + # define the colors to denote the party types labs(y="vote shares", fill = "Party Type", title = "Shares of populist and far-right parties' vote shares in Poland") + # Adjust labels of graph theme_minimal() # add a nice theme
Döring, Holger and Philip Manow. 2019. Parliaments and governments database (ParlGov): Information on parties, elections and cabinets in modern democracies. Development version.