The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
In this vignette we use twfy
to take a look at the MP for Keighley, West Yorkshire.
library(twfy)
We can get its detailed by name or by any postcode
keighley <- getConstituency("Keighley")
Who is the current MP? This time we’ll use the postcode lookup
mp <- getMP(postcode="BD21 2DH")
Keighley’s MP is
mp$full_name
## [1] "John Grogan"
He’s a member of the Labour Party
mp$party
## [1] "Labour"
and since we’re in England he’s in the House of Commons, represented as 1.
mp$house
## [1] "1"
We can find him with two identifiers, the identifier for his current term in office
mp$member_id
## [1] "41872"
but more lastingly by his person id
mp$person_id
## [1] "10248"
With person_id
we can get the details of all of his spells in the House of Commons like this
mp_per <- getPerson(mp$person_id)
Now, what’s he been talking about in Parliamentary debates?
mp_talk <- getDebates(person=mp$person_id)
Debate results are fairly structured objects
names(mp_talk)
## [1] "info" "searchdescription" "rows"
names(mp_talk$info) # what we've got to work with
## [1] "s" "results_per_page" "page"
## [4] "first_result" "total_results" "spelling_correction"
the output is paged, so there are
mp_talk$info$total_results
## [1] 519
entries, of which we are seeing from
mp_talk$info$results_per_page
## [1] 20
counting from
mp_talk$info$first_result
## [1] 1
to get the second page, we’d call getDebates
again specifying page=2
.
Let’s take a look at the first recorded entry
first_entry <- mp_talk$rows[1,]
first_entry$hdate
## [1] "2010-04-08"
clarifying an important issue
first_entry$body
## [1] "<p pid=\"b.1177.6/1\">Will the Secretary of State say a few words about the impact of the proposed level of feed-in tariffs on the development of anaerobic digestion plants such as the proposed Selby renewable energy plant, which is set to power 10,000 homes in the town?</p>"
The speaker
field embeds a data.frame with the speaker’s details, from which we note that he was not representing Keighley at that time but rather
first_entry$speaker$constituency
## [1] "Selby"
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.