R/parliament_data.R
parliament_data.Rd
A function that prepares data for parliamentary plots
parliament_data(election_data = NULL, parl_rows = NULL,
party_seats = election_data$seats, group = NULL, plot_order = NULL,
type = c("horseshoe", "semicircle", "circle", "classroom",
"opposing_benches"))
aggregate election results
number of rows in parliament
seats per party
grouping variable for separate chunks. e.g. opposing benches in UK parliament
plot the data in a specified order
type of parliament (horseshoe, semicircle, circle, classroom, opposing benches)
data <- election_data[
election_data$country == "USA" &
election_data$house == "Representatives" &
election_data$year == "2016",
]
usa_data <- parliament_data(
election_data = data,
type = "semicircle",
party_seats = data$seats,
parl_rows = 8
)