This repository contains all necessary data and code to replicate tables and figures in 'The Emergence of Party-Based Political Careers in the UK, 1801-1918' (Cox and Nowacki, forthcoming).
To run the replication in one go, we have added a makefile that runs all scripts in the necessary order. To execute, run
make R
from the repository's root directory. The makefile also comments on what scripts are responsible for what output.
There are three folders in the repository:
codecontains all necessaryRscripts.datacontains all original data.outputcontains all data and output generated by running scripts (divided into tables, figures and modified data)
If executed manually, R scripts should be executed in the following order. Figures / Tables in parentheses indicate respective exhibits in the manuscript.
# Data preparation
0_functions.R
prepare_data_elections.R
compute_chat.R (Fig. 11)
prepare_data_candidates.R
prepare_data_government.R
prepare_within_career.R
prepare_office.R
prepare_stepping_stones.R
prepare_whip_es.R
partisan_simulation (Fig. )
# Figures (Main)
plot_aggregate_stats.R (Fig. 1)
analysis_nomvalue.R (Fig. 2)
plot_safety.R (Fig. 3)
plot_running_again.R (Fig. 4)
analysis_rd.R (Fig. 5, Figs. 15, 16, 17, Tbl. 4 and 5)
analysis_candidates.R (Fig. 6)
figure7.R (Fig. 7)
plot_stepping_stones.R (Fig. 8)
plot_stepping_decadal.R (Fig. 9)
cabinet_loyalty.R (Fig. 10)
plot_patronal.R (Figs. 12, 13)
# Figures and Tables (Appendix only)
analysis_double_cand.R (Fig. 14)
plot_within_career_cabinet.R (Fig. 18)
# Tables (Main)
analysis_candidates_did.R (Table 1)
descriptives.R (Table 2)
table_within_career_reg.R (Table 3)
# Tables 4 and 5 produced earlier [Figures (Main)]
To run this repository, you will need R (version 4.1 or higher). You will also need the following packages:
tidyverse, rio, lubridate, lfe, devtools, stringr, rdrobust, viridis, broom, modelsummary, kableExtra, extrafont, RColorBrewer, patchwork, fixest