Petitions in the UK Parliament
Are all petitions with at least 100,000 signatures debated in the UK parliament?
In case you haven’t heard, there is a petition to withdraw the invitation for a state visit that Theresa May extended to Donald Trump. You can find it here. The website states that the “Parliament considers all petitions that get more than 100,000 signatures for a debate”. How often does this actually happen though?
Load libraries
RJSONIO
to process JSON datajanitor
to clean column names with spacesdplyr
to process data frames legibly, and using magrittr pipes
library(RJSONIO)
library(dplyr)
library(janitor)
Prepare data
I downloaded 500 epetitions (sorted by number of signatories, in descending order) in csv format from the UK parliament data site
The following code
- reads the csv file,
- sorts by the number of signatures that the petition received
- filters only the petitions that reached at least 100000 signatures
- extracts the petition number from the “uri” column and adds to a new column named “petition_number”
- builds a url to the petition page, added to a new column named “url”
- and finally stores this in the data.frame “petitions_100k”
read.csv("epetitions.csv") %>%
clean_names() %>%
arrange(desc(number_of_signatures)) %>%
filter(number_of_signatures >= 100000) %>%
mutate(petition_number = sub(".*/", "", uri)) %>%
mutate(url = paste0("http://lda.data.parliament.uk/epetitions/", petition_number, ".json")) -> petitions_100k
Download the outcomes of the petitions
First, I downloaded the json data for petitions with at least 100k signatures, using the urls constructed above.
Then I extracted the field in which the debate url is listed. Presumably, where there was no debate, there is no url and a NULL value is returned. as.character()
ensures that the NULL values are not dropped
petition_outcome <- lapply(petitions_100k$url, fromJSON)
petitions_100k$debate_url <- lapply(petition_outcome, function(x) x$result$primaryTopic$debate$`_about`)
List petitions for which no debate links exist
I am Assuming that where there is no link, the petition was not debated in parliament; I used is.null()
to filter all rows with a NULL value in the “debate_url” column.
petitions_100k %>%
filter(debate_url == "NULL") %>%
select(label)
## label
## 1 Stop all immigration and close the UK borders until ISIS is defeated.
## 2 Consider a vote of No Confidence in Jeremy Hunt, Health Secretary
## 3 Repeal the new Surveillance laws (Investigatory Powers Act)
## 4 Vote no confidence in David Cameron
## 5 Hold a General Election in 2016
## 6 Hold a public inquiry and a referendum over turning all schools into academies
## 7 Call on David Cameron to act to protect our steel industry & recall Parliament
## 8 Make it illegal for a company to require women to wear high heels at work
## 9 Scrap plans to force state schools to become academies.
## 10 Ban the sale of fireworks to the public and only approve organised displays.
## 11 Put a max of £1200 on car insurance for 18-25 year olds
## 12 Air-drop life saving aid into the starving cities in Syria.
## 13 Reverse the ESA disability benefit cut
## 14 Benjamin Netanyahu to be arrested for war crimes when he arrives in London
## 15 Make it a specific criminal offence to attack any member of NHS Medical Staff.
## 16 Demand an end to the pay restraint imposed on agenda for change NHS staff.
## 17 Shut down the domestic ivory market in the UK.
## 18 Parliament to sit on Saturdays which should be a normal working day for MPs.
nrow(petitions_100k)
## [1] 51
That is, 18 out of 51 petitions were not debated in parliament, in spite of having at least 100,000 signatories.
But, but, “Parliament considers all petitions that get more than 100,000 signatures for a debate”! Well, clearly, considers is the keyword!
But that didn’t stop me from signing the trump petition. The count is ~350k, at the time of writing, about 3 hours after the petition was created.