Title: | Provides Easy Downloading Capabilities for the UK Parliament API |
---|---|
Description: | Provides functions to download data from the <https://explore.data.parliament.uk/> APIs. Because of the structure of the API, there is a named function for each type of available data for ease of use, as well as some functions designed to retrieve specific pieces of commonly used data. Functions for each new API will be added as and when they become available. |
Authors: | Evan Odell [aut, cre] |
Maintainer: | Evan Odell <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.8.0.9000 |
Built: | 2025-01-30 11:23:37 UTC |
Source: | https://github.com/rOpenGov/hansard |
Imports data on all answered parliamentary questions in the
House of Commons and/or in the House of Lords. The mp_id
,
tabling_mp_id
and answering_body
parameters accept a single
ID or department names, or a list of IDs or department names, respectively.
This is the most flexible of the various functions that look
up questions, as it queries all types of questions in both houses with a
wide selection of parameters: The member who asks the question, the member
who answers it and the relevant department can all be used to query the API.
mp_id
, tabling_mp_id
and answering_body
all accept
lists of multiple relevant search parameters. This can be in the form of a
list, a data.frame column, a character vector, etc.
all_answered_questions( mp_id = NULL, tabling_mp_id = NULL, house = NULL, answering_body = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_all_answered_questions( mp_id = NULL, tabling_mp_id = NULL, house = NULL, answering_body = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
all_answered_questions( mp_id = NULL, tabling_mp_id = NULL, house = NULL, answering_body = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_all_answered_questions( mp_id = NULL, tabling_mp_id = NULL, house = NULL, answering_body = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_id |
Accepts a member ID or vector of member IDs, and returns a
tibble with all available questions answered by that member. Includes both
oral and written questions, and includes members of the House of Commons
and the House of Lords. If |
tabling_mp_id |
Accepts a member ID or vector of member IDs, and
returns a tibble with all available questions asked by that member,
subject to all other parameters. Includes both oral and written questions,
and includes members of the House of Commons and the House of Lords. If
|
house |
The house to return questions from. Accepts either the short
name of the legislature (e.g. |
answering_body |
The name of the government department that answers the
question, or a vector of government deparment names. Accepts either the
short name name of a department (e.g. |
start_date |
The earliest date to include in the tibble. Accepts
character values in |
end_date |
The latest date to include in the tibble. Defaults to
|
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on all answered questions in the House of Commons and the House of Lords.
## Not run: # All questions answered by Nicola Blackwood from 1 January 2017 onwards x <- all_answered_questions(4019, start_date = "2017-01-01") # All questions answered by Nicola Blackwood from 1 January 2017 onwards # returns variables in camelCase style y <- all_answered_questions(4019, start_date = "2017-01-01", tidy_style = "small_camel" ) # All questions asked by Andrew Dismore from 1 January 2017 onwards z <- hansard_all_answered_questions( tabling_mp_id = 179, start_date = "2017-01-01" ) # Return all questions asked in the House of Lords # answered by the Department for Education. a <- hansard_all_answered_questions(house = "lords", answering_body = 60) # Returns all questions asked in the House of Lords # answered by the Department for Education. b <- hansard_all_answered_questions(house = 2, answering_body = "Education") # Accepts multiple inputs for mp_id, tabling_mp_id and answering_body w <- hansard_all_answered_questions( mp_id = c(4019, 3980), tabling_mp_id = c(338, 172), answering_body = c("health", "justice"), start_date = "2016-12-18", end_date = "2017-03-12" ) ## End(Not run)
## Not run: # All questions answered by Nicola Blackwood from 1 January 2017 onwards x <- all_answered_questions(4019, start_date = "2017-01-01") # All questions answered by Nicola Blackwood from 1 January 2017 onwards # returns variables in camelCase style y <- all_answered_questions(4019, start_date = "2017-01-01", tidy_style = "small_camel" ) # All questions asked by Andrew Dismore from 1 January 2017 onwards z <- hansard_all_answered_questions( tabling_mp_id = 179, start_date = "2017-01-01" ) # Return all questions asked in the House of Lords # answered by the Department for Education. a <- hansard_all_answered_questions(house = "lords", answering_body = 60) # Returns all questions asked in the House of Lords # answered by the Department for Education. b <- hansard_all_answered_questions(house = 2, answering_body = "Education") # Accepts multiple inputs for mp_id, tabling_mp_id and answering_body w <- hansard_all_answered_questions( mp_id = c(4019, 3980), tabling_mp_id = c(338, 172), answering_body = c("health", "justice"), start_date = "2016-12-18", end_date = "2017-03-12" ) ## End(Not run)
bill_publications()
A character vector of possible types of bill publications.
For use with bill_publications()
bill_publication_types
bill_publication_types
A character vector containing 38 elements
Returns details of all publications associated with a specific bill or all bills.
bill_publications( ID = NULL, publication_type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = FALSE ) hansard_bill_publications( ID = NULL, publication_type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = FALSE )
bill_publications( ID = NULL, publication_type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = FALSE ) hansard_bill_publications( ID = NULL, publication_type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = FALSE )
ID |
The ID of a specific bill to return publications for.
If |
publication_type |
The type of bill publication to return, in the form
of a string. For a character vector of bill publication types, see
|
start_date |
Only includes bill publications on or after this date.
Accepts character values in |
end_date |
Only includes bill publicationson or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on bill publications.
## Not run: # Requesting a specific publication x <- bill_publications(ID = 752025) # Requesting all publications after a given date y <- bill_publications(start_date = "2018-01-01") ## End(Not run)
## Not run: # Requesting a specific publication x <- bill_publications(ID = 752025) # Requesting all publications after a given date y <- bill_publications(start_date = "2018-01-01") ## End(Not run)
Returns a tibble with all possible bill stage types.
bill_stage_types(tidy = TRUE, tidy_style = "snake", verbose = TRUE) hansard_bill_stage_types(tidy = TRUE, tidy_style = "snake", verbose = TRUE)
bill_stage_types(tidy = TRUE, tidy_style = "snake", verbose = TRUE) hansard_bill_stage_types(tidy = TRUE, tidy_style = "snake", verbose = TRUE)
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble of bill stage types.
## Not run: x <- bill_stage_types() ## End(Not run)
## Not run: x <- bill_stage_types() ## End(Not run)
Imports data on House of Commons and House of Lords bills.
bills( ID = NULL, amendments = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_bills( ID = NULL, amendments = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
bills( ID = NULL, amendments = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_bills( ID = NULL, amendments = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
The ID of a given bill to return data on. If |
amendments |
If |
start_date |
Only includes bills introduced on or after this date.
Accepts character values in |
end_date |
Only includes bills introduced on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on bills before the House of Lords and the House of Commons.
## Not run: # Download data on all bills x <- bills() # Download data on all bill amendments x <- bills(amendments = TRUE) # Download data on a specific bills x <- bills(1719) # Download data on all bills introduced after a given date x <- bills(start_date = "2016-01-01") ## End(Not run)
## Not run: # Download data on all bills x <- bills() # Download data on all bill amendments x <- bills(amendments = TRUE) # Download data on a specific bills x <- bills(1719) # Download data on all bills introduced after a given date x <- bills(start_date = "2016-01-01") ## End(Not run)
Imports data on House of Commons answered questions. If all parameters are left empty, imports all available answered questions in a tibble.
If answering_department
and/or answered_by
are
given a vector with multiple deparments/IDs, all possible combination of
those criteria are returned.
commons_answered_questions( answering_department = NULL, answered_by = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_answered_questions( answering_department = NULL, answered_by = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_answered_questions( answering_department = NULL, answered_by = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_answered_questions( answering_department = NULL, answered_by = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
answering_department |
Accepts the name of a department or a
list of department names. Returns a tibble with all answered questions
in the House of Commons from the given department. Defaults to |
answered_by |
Accepts the ID of an MP, or a list of IDs. Returns a
tibble with all answered questions in the House of Commons by the given
MP(s). Defaults to |
start_date |
Only includes questions answered introduced on or after
this date. Accepts character values in |
end_date |
Only includes questions answered on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on all answered questions in the House of Commons.
## Not run: x <- commons_answered_questions( answering_department = c("health", "education"), answered_by = c("4019", "1542", "111"), start_date = "2017-01-01" ) y <- commons_answered_questions( start_date = "2017-03-26", end_date = "2017-04-01" ) ## End(Not run)
## Not run: x <- commons_answered_questions( answering_department = c("health", "education"), answered_by = c("4019", "1542", "111"), start_date = "2017-01-01" ) y <- commons_answered_questions( start_date = "2017-03-26", end_date = "2017-04-01" ) ## End(Not run)
Returns a tibble with the divisions (votes) in the House of Commons on a given date.
commons_division_date( date = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_division_date( date = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_division_date( date = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_division_date( date = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
date |
Returns all divisions on a given date.
Defaults to |
extra_args |
Additional parameters to pass to API.
Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with the dates of divisions in the House of Commons.
## Not run: # all commons divisions on 19 April 2017 x <- commons_division_date("2017-04-19") ## End(Not run)
## Not run: # all commons divisions on 19 April 2017 x <- commons_division_date("2017-04-19") ## End(Not run)
Imports data on House of Commons divisions (votes), either full details on how each member voted, or a summary of vote totals.
commons_divisions( division_id = NULL, division_uin = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_divisions( division_id = NULL, division_uin = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_divisions( division_id = NULL, division_uin = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_divisions( division_id = NULL, division_uin = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
division_id |
The id of a particular vote. If empty, returns a
tibble with information on all commons divisions, subject to all other
parameters. Defaults to |
division_uin |
The UIN of a particular vote. If empty, returns a
tibble with information on all commons divisions, subject to all other
parameters. Defaults to |
summary |
If |
start_date |
Only includes divisions on or after this date. Accepts
character values in |
end_date |
Only includes divisions on or before this date. Accepts
character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with the results of divisions in the House of Commons.
## Not run: ## All commons divisions x <- commons_divisions() ## Vote breakdown of specific commons division y <- commons_divisions(division_id = 694163, summary = FALSE) ## End(Not run)
## Not run: ## All commons divisions x <- commons_divisions() ## Vote breakdown of specific commons division y <- commons_divisions(division_id = 694163, summary = FALSE) ## End(Not run)
Imports data on House of Commons oral question times. Query with parameters
for the parliamentary session or the question ID. If tidy=TRUE
,
datetime variables are converted to POSIXct
class.
commons_oral_question_times( session = NULL, question_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_oral_question_times( session = NULL, question_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_oral_question_times( session = NULL, question_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_oral_question_times( session = NULL, question_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
session |
Accepts a session in format |
question_id |
Accepts a question time ID, and returns a tibble of that question time. |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with information on oral question times in the House of Commons.
## Not run: x <- commons_oral_question_times(session = "2016/17", question_id = "685697") ## End(Not run)
## Not run: x <- commons_oral_question_times(session = "2016/17", question_id = "685697") ## End(Not run)
Imports data on House of Commons oral questions, based on the asking MP,
the answering department and the date. The mp_id
and
answering_department
parameters accept a single ID or department
names, or a list of IDs or department names, respectively.
commons_oral_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_oral_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_oral_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_oral_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_id |
The ID of a given MP asking an oral question, or a list of
MP Ids. Defaults to |
answering_department |
The name of a department, or a list of
departments. Defaults to |
start_date |
Only includes questions answered on or after this date.
Accepts character values in |
end_date |
Only includes questions answered on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on all oral questions in the House of Commons.
## Not run: # Oral questions from a single MP to a single department x <- commons_oral_questions(mp_id = 4019, answering_department = "education") ## Questions from multiple MPs and to multiple departments y <- commons_oral_questions( mp_id = c(4019, 4051, 4588), answering_department = c("education", "health") ) ## End(Not run)
## Not run: # Oral questions from a single MP to a single department x <- commons_oral_questions(mp_id = 4019, answering_department = "education") ## Questions from multiple MPs and to multiple departments y <- commons_oral_questions( mp_id = c(4019, 4051, 4588), answering_department = c("education", "health") ) ## End(Not run)
Imports the parliamentary thesaurus. The API is rate limited to 5500 requests at a time, so some use of parameters is required.
commons_terms( search = NULL, class = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_terms( search = NULL, class = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_terms( search = NULL, class = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_terms( search = NULL, class = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
search |
A string to search the parliamentary thesaurus for. |
class |
The class of definition to be returned Accepts one of
|
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with results from the parliamentary thesaurus.
## Not run: x <- commons_terms(search = "estate") x <- commons_terms(search = "estate", class = "ORG") ## End(Not run)
## Not run: x <- commons_terms(search = "estate") x <- commons_terms(search = "estate", class = "ORG") ## End(Not run)
Imports data in a tibble on House of Commons written questions.
commons_written_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_written_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
commons_written_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_written_questions( mp_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_id |
Accepts a member ID or a list of member IDs and returns a
tibble with all written questions asked by that MP or list of MPs. If
|
answering_department |
Accepts a string with a department name or
partial name, or a list of such strings. The query acts as a search, so
passing |
start_date |
Only includes questions tabled on or after this date.
Accepts character values in |
end_date |
Only includes questions tabled on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on written questions in the House of Commons.
## Not run: # Returns a tibble with written questions from Jon Trickett, # answered by the Cabinet Office. x <- commons_written_questions( mp_id = 410, answering_department = "cabinet office" ) # Returns a tibble with written questions from Jon Trickett or Diane Abbott, # and answered by the Cabinet Office or the Home Office. x <- commons_written_questions( mp_id = c(410, 172), answering_department = c("cabinet", "home") ) ## End(Not run)
## Not run: # Returns a tibble with written questions from Jon Trickett, # answered by the Cabinet Office. x <- commons_written_questions( mp_id = 410, answering_department = "cabinet office" ) # Returns a tibble with written questions from Jon Trickett or Diane Abbott, # and answered by the Cabinet Office or the Home Office. x <- commons_written_questions( mp_id = c(410, 172), answering_department = c("cabinet", "home") ) ## End(Not run)
Imports data on House of Commons constituencies, returning a tibble of all current and/or former Westminster constituencies, subject to parameters.
constituencies( current = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_constituencies( current = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
constituencies( current = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_constituencies( current = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
current |
If |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details of Westminster constituencies.
## Not run: x <- constituencies() y <- constituencies(current = FALSE) ## End(Not run)
## Not run: x <- constituencies() y <- constituencies(current = FALSE) ## End(Not run)
Return data on the content, signatories, and sponsors of early day motions (EDMS).
early_day_motions( edm_id = NULL, session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), signatures = 1, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_early_day_motions( edm_id = NULL, session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), signatures = 1, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
early_day_motions( edm_id = NULL, session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), signatures = 1, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_early_day_motions( edm_id = NULL, session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), signatures = 1, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
edm_id |
Accepts the ID number of an early day motion, and returns
data on that motion. If |
session |
Accepts a parliamentary session, in |
start_date |
Only includes early day motions tabled on or after
this date. Accepts character values in |
end_date |
Only includes early day motions tabled on or before
this date. Accepts character values in |
signatures |
The minimum number of signatures required for inclusion in the tibble. Defaults to 1. |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
Early Day Motion IDs reset for each parliamentary session, so not including
a query for session
but including an edm_id
will return
multiple early day motions with the same ID code from different
parliamentary sessions.
A tibble with details on the content, signatories and sponsors of all or a specified early day motions.
## Not run: # Returns all EDMs with a given ID x <- early_day_motions(edm_id = 1073) # Return a specific early day motion by ID x <- early_day_motions(edm_id = 1073, session = "2017/19") ## End(Not run)
## Not run: # Returns all EDMs with a given ID x <- early_day_motions(edm_id = 1073) # Return a specific early day motion by ID x <- early_day_motions(edm_id = 1073, session = "2017/19") ## End(Not run)
A quick and dirty function for a specific use case, use with caution.
edm_text(id, tidy = TRUE, tidy_style = "snake", verbose = TRUE)
edm_text(id, tidy = TRUE, tidy_style = "snake", verbose = TRUE)
id |
The ID of an individual Early Day Motion, or a vector of IDs,
as found in the |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble of containing the EDM text and its ID.
## Not run: y <- edm_text(c("811291", "811292", "811293")) ## End(Not run)
## Not run: y <- edm_text(c("811291", "811292", "811293")) ## End(Not run)
Returns the name and party of all candidates standing in an election, for each constituency. Note that for general elections this can return a very large tibble with hundreds of variables.
election_candidates( ID = NULL, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_election_candidates( ID = NULL, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
election_candidates( ID = NULL, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_election_candidates( ID = NULL, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
Accepts an ID for a general or by-election from the 2010 General
Election onwards, and returns the results. If |
constit_details |
If |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
## Not run: x <- election_candidates(ID = 382037) y <- election_candidates() z <- election_candidates(constit_details = TRUE) ## End(Not run)
## Not run: x <- election_candidates(ID = 382037) y <- election_candidates() z <- election_candidates(constit_details = TRUE) ## End(Not run)
Imports results from general and by-elections from the 2010 General Election onwards.
election_results( ID = NULL, all_data = FALSE, calculate_percent = FALSE, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_election_results( ID = NULL, all_data = FALSE, calculate_percent = FALSE, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
election_results( ID = NULL, all_data = FALSE, calculate_percent = FALSE, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_election_results( ID = NULL, all_data = FALSE, calculate_percent = FALSE, constit_details = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
Accepts an ID for a general or by-election from the 2010 General
Election onwards, and returns the results. If |
all_data |
If |
calculate_percent |
If |
constit_details |
If |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with the results of all general and by-elections, or of a specified general election or by-election.
## Not run: x <- election_results(ID = 382037) y <- election_results() z <- election_results(calculate_percent = TRUE, constit_details = TRUE) w <- election_results(ID = 730039, all_data = TRUE) ## End(Not run)
## Not run: x <- election_results(ID = 382037) y <- election_results() z <- election_results(calculate_percent = TRUE, constit_details = TRUE) w <- election_results(ID = 730039, all_data = TRUE) ## End(Not run)
Imports data on general and by-elections from the 2010 General Election onwards.
If both ID
and type
are used to query the API,
ID
takes precedence and type
is ignored.
elections( ID = NULL, type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), label = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_elections( ID = NULL, type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), label = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
elections( ID = NULL, type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), label = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_elections( ID = NULL, type = NULL, start_date = "1900-01-01", end_date = Sys.Date(), label = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
Accepts an ID for a general or by-election from the 2010 General
Election onwards, and returns the date and type of the elction.
If |
type |
Accepts |
start_date |
Only includes elections held on or after this date.
Accepts character values in |
end_date |
Only includes elections held on or before this date.
Accepts character values in |
label |
Label of the election. By-elections are in
|
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on all elections from the 2010 General Election onwards, subject to function parameters. Includes the election ID, the date, and the type of election(s).
## Not run: x <- elections(517994) ## End(Not run)
## Not run: x <- elections(517994) ## End(Not run)
Imports data on a given epetition. For bulk epetion data,
see epetition_tibble()
.
epetition( ID = NULL, by_constituency = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_epetition( ID = NULL, by_constituency = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
epetition( ID = NULL, by_constituency = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_epetition( ID = NULL, by_constituency = FALSE, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
The ID of a given petition. If |
by_constituency |
Accepts either |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on electronic petitions submitted to parliament.
## Not run: x <- epetition(ID = 706964, by_constituency = TRUE) ## End(Not run)
## Not run: x <- epetition(ID = 706964, by_constituency = TRUE) ## End(Not run)
Get data on all epetitions submitted to parliament, with the label, sponsor,
number of signatures, date created and epetition ID. For greater detail on
indidivual epetitions, see epetition()
.
epetition_tibble( min_signatures = 1, max_signatures = NULL, status = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_epetition_tibble( min_signatures = 1, max_signatures = NULL, status = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
epetition_tibble( min_signatures = 1, max_signatures = NULL, status = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_epetition_tibble( min_signatures = 1, max_signatures = NULL, status = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
min_signatures |
The minimum number of signatures required for inclusion in the tibble. Defaults to 1. |
max_signatures |
The maximum number of signatures required for
inclusion in the tibble. If |
status |
The status of the petition, either |
start_date |
Only includes epetitions created on or after this date.
Accepts character values in |
end_date |
Only includes epetitions created on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on electronic petitions submitted to parliament.
## Not run: x <- epetition_tibble() y <- epetition_tibble(max_signatures = 500) z <- epetition_tibble(start_date = "2016-12-01", end_date = "2017-04-25") ## End(Not run)
## Not run: x <- epetition_tibble() y <- epetition_tibble(max_signatures = 500) z <- epetition_tibble(start_date = "2016-12-01", end_date = "2017-04-25") ## End(Not run)
Provides functions to request data from the data.parliament.uk APIs. Because of the structure of the data.parliament.uk API, there is a named function for each type of available data for ease of use. Functions for each new API will be added as and when they become available on <data.parliament.uk>. The API is rate limited to returning 5500 rows per request in some instances, though this has been inconsistent in testing.
The API itself is still in beta, and only about half of the planned datasets are currently available. The package name is optimistic, as the actual contents of the Hansard are not yet available through this API.
In addition to the standard function names, each function in the
hansard
package has a wrapper where the name is prefixed with
'hansard_'
. For example, both bills()
and
hansard_bills()
will return the same result. This is because
function names are taken from the specific API on
http://explore.data.parliament.uk/, but they are often not very
informative and could clash with functions in other packages (e.g.
bills()
is not a term unique to the British parliament).
For more details please see the vignette, or the API documentation on http://explore.data.parliament.uk/.
This package is in no way officially related to or endorsed by the UK Parliamentary Data Service.
Accepts an ID number for a member of the House of Commons, and returns a tibble of their votes.
lord_vote_record( peer_id = NULL, lobby = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lord_vote_record( peer_id = NULL, lobby = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lord_vote_record( peer_id = NULL, lobby = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lord_vote_record( peer_id = NULL, lobby = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
peer_id |
The ID number of a member of the House of Lords. A value
must be included for this parameter. Use the |
lobby |
Accepts one of |
start_date |
Only includes divisions on or after this date. Accepts
character values in |
end_date |
Only includes divisions on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on the voting record of a member of the House of Lords.
## Not run: x <- lord_vote_record(530, lobby = "all") x <- lord_vote_record(530, lobby = "content") x <- lord_vote_record(530, lobby = "notcontent") x <- lord_vote_record(530, lobby = "not-content") # This will also work ## End(Not run)
## Not run: x <- lord_vote_record(530, lobby = "all") x <- lord_vote_record(530, lobby = "content") x <- lord_vote_record(530, lobby = "notcontent") x <- lord_vote_record(530, lobby = "not-content") # This will also work ## End(Not run)
Returns a tibble with all available House of Lords amendments, subject to parameters.
lords_amendments( decision = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_amendments( decision = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_amendments( decision = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_amendments( decision = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
decision |
The decision on the amendments. Accepts one of
|
start_date |
Only includes amendments to bills introduced on or after
this date. Accepts character values in |
end_date |
Only includes amendments to bills introduced on or before
this date. Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on amendments proposed by the House of Lords.
## Not run: x <- lords_amendments() x <- lords_amendments(decision = "Withdrawn") ## End(Not run)
## Not run: x <- lords_amendments() x <- lords_amendments(decision = "Withdrawn") ## End(Not run)
Imports data on House of Lords attendance on a given date.
lords_attendance_date( date = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_attendance_date( date = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_attendance_date( date = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_attendance_date( date = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
date |
Accepts a date to return attendance data for. Accepts
character values in |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
Please note that House of Lords attendance data is not as tidy as some of the others that are accessible through this API, and so additional work on the return from the API may be required.
Also note that this API does not appear to have been updated with data after 2017-01-31.
A tibble with details on the lords who attended on a given date.
## Not run: x <- lords_attendance_date(date = "2016-03-01") ## End(Not run)
## Not run: x <- lords_attendance_date(date = "2016-03-01") ## End(Not run)
Imports data on House of Lords attendance from each parliamentary session. Please note that the attendance data is not as tidy as some of the others that are accessible through this API, and so additional work to prepare this data in a way that you want may be required.
lords_attendance_session( session_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_attendance_session( session_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_attendance_session( session_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_attendance_session( session_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
session_id |
The ID of the House of Lords session. If |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
To return a tibble with all codes from available individual sessions, use
lords_attendance_session(session_id=NULL)
, or use
lords_sessions()
to retrieve codes for a given date range.
Attendance from multiple sessions can be accessed by using lapply
with the output from lords_sessions()
.
Please note that House of Lords attendance data is not as tidy as some of the others that are accessible through this API, and so additional work on the return from the API may be required.
Also note that this API does not appear to have been updated with data after 2017-01-31.
A tibble with details on the lords who attended a given session.
## Not run: x <- lords_attendance_session(session_id = 706178) # Returns a list of data frames with details of # attendance for each day of a given vector of sessions. u <- lords_sessions(start_date = "2017-01-01") m <- lapply(u$about, lords_attendance_session) ## End(Not run)
## Not run: x <- lords_attendance_session(session_id = 706178) # Returns a list of data frames with details of # attendance for each day of a given vector of sessions. u <- lords_sessions(start_date = "2017-01-01") m <- lapply(u$about, lords_attendance_session) ## End(Not run)
Imports data on House of Lords divisions. Either a general query subject to parameters, or the results of a specific division. Individual divisions can be queried to return a short summary of the votes, or details on how each peer voted.
lords_divisions( division_id = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_divisions( division_id = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_divisions( division_id = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_divisions( division_id = NULL, summary = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
division_id |
The id of a particular vote. If empty, returns a tibble
with information on all lords divisions. Defaults to |
summary |
If |
start_date |
Only includes divisions on or after this date. Accepts
character values in |
end_date |
Only includes divisions on or before this date. Accepts
character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with the results of divisions in the House of Lords.
## Not run: x <- lords_divisions(division_id = 705891, summary = TRUE) x <- lords_divisions(division_id = 705891, summary = FALSE) # Return all lords divisions in 2016 x <- lords_divisions(NULL, FALSE, start_date = "2016-01-01", end_date = "2016-12-31" ) ## End(Not run)
## Not run: x <- lords_divisions(division_id = 705891, summary = TRUE) x <- lords_divisions(division_id = 705891, summary = FALSE) # Return all lords divisions in 2016 x <- lords_divisions(NULL, FALSE, start_date = "2016-01-01", end_date = "2016-12-31" ) ## End(Not run)
Registered financial interests of members of the House of Lords.
If peer_id=NULL
the actual details of registered interests
are stored in a nested data frame.
lords_interests( peer_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_interests( peer_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_interests( peer_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_interests( peer_id = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
peer_id |
The ID of a member of the House of lords. If |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on the interests of peers in the House of Lords.
## Not run: x <- lords_interests(4170) y <- lords_interests() ## End(Not run)
## Not run: x <- lords_interests(4170) y <- lords_interests() ## End(Not run)
Returns the session code and other basic details for individual House of Lords sittings. Note that this API does not appear to have been updated with data after 2017-01-31.
lords_sessions( start_date = "1900-01-01", end_date = Sys.Date(), tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_sessions( start_date = "1900-01-01", end_date = Sys.Date(), tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_sessions( start_date = "1900-01-01", end_date = Sys.Date(), tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_sessions( start_date = "1900-01-01", end_date = Sys.Date(), tidy = TRUE, tidy_style = "snake", verbose = TRUE )
start_date |
Only includes sessions starting on or after this date.
Accepts character values in |
end_date |
Only includes sessions ending on or before this date.
Accepts character values in |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
## Not run: a <- lords_sessions(start_date = "2017-01-01", end_date = "2017-01-31") ## End(Not run)
## Not run: a <- lords_sessions(start_date = "2017-01-01", end_date = "2017-01-31") ## End(Not run)
Imports data on House of Lords written questions asked by a given peer(s), and/or directed to a given department.
lords_written_questions( peer_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_written_questions( peer_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
lords_written_questions( peer_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_written_questions( peer_id = NULL, answering_department = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
peer_id |
Accepts a member ID or list of IDs, and returns a tibble
with all written questions asked by that member or members. If |
answering_department |
Accepts a string with a department name or
partial name or a list of departmental names, and returns all written
questions by that department. The query acts as a search, so entering
|
start_date |
Only includes questions tabled on or after this date.
Accepts character values in |
end_date |
Only includes questions tabled on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on written questions in the House of Lords.
## Not run: x <- lords_written_questions() # Returns all written questions ever x <- lords_written_questions( peer_id = c(3526, 4176), answering_department = c( "cabinet", "Transport" ) ) ## End(Not run)
## Not run: x <- lords_written_questions() # Returns all written questions ever x <- lords_written_questions( peer_id = c(3526, 4176), answering_department = c( "cabinet", "Transport" ) ) ## End(Not run)
Imports basic details on current and former Members of Parliament including the Lords and the Commons. For more details on a given member see mnis_full_biog from the mnis package.
members( ID = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_members( ID = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) commons_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) lords_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
members( ID = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_members( ID = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) commons_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_commons_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) lords_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_lords_members( extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
The ID of a member of the House of Commons or the House of Lords
to return data on. If |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with data on members of the House of Commons
(commons_members()
), the House of Lords, (lords_members()
),
or both (members()
).
members
Basic details on a given member from either house
commons_members
MPs in the House of Commons
lords_members
Peers in the House of Lords
## Not run: a <- members() x <- members(172) y <- commons_members() z <- lords_members() ## End(Not run)
## Not run: a <- members() x <- members(172) y <- commons_members() z <- lords_members() ## End(Not run)
Note that there are problems with the remote endpoint for this API, and that correct search queries may not return any results.
members_search( search = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_members_search( search = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
members_search( search = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_members_search( search = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
search |
Accepts any lucene query string, using * as a multiple
character wildcard, and ? as the single character wildcard. Searchs are
not case sensitive. If |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
Function searches for the string and returns a tibble with all matches from
both houses of parliament. Returns all partial matches in the members'
names, constituencies, twitter handle and webpage. The default search is
NULL
, which returns a tibble of all members of both houses, the
same result as members()
.
A tibble with the results of the search.
## Not run: x <- members_search("*chris*") x <- members_search(search = "*chris*") ## End(Not run)
## Not run: x <- members_search("*chris*") x <- members_search(search = "*chris*") ## End(Not run)
Imports data on early day motions signed, sponsored or primarily sponsored by a given MP or Peer.
mp_edms( mp_id = NULL, primary_sponsor = TRUE, sponsor = TRUE, signatory = TRUE, full_data = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_mp_edms( mp_id = NULL, primary_sponsor = TRUE, sponsor = TRUE, signatory = TRUE, full_data = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_edms( mp_id = NULL, primary_sponsor = TRUE, sponsor = TRUE, signatory = TRUE, full_data = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_mp_edms( mp_id = NULL, primary_sponsor = TRUE, sponsor = TRUE, signatory = TRUE, full_data = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_id |
The ID number of an MP or Peer. Required parameter, Defaults
to |
primary_sponsor |
Includes all early day motions where the given
member is the primary sponsor in the tibble. Defaults to |
sponsor |
Includes all early day motions where the given member a
sponsor (but not the primary sponsor) in the tibble.
Defaults to |
signatory |
Includes all early day motions signed (but not sponsored
or primarily sponsored) by the given member in the tibble.
Defaults to |
full_data |
If |
start_date |
Only includes early day motions signed on or after this
date. Accepts character values in |
end_date |
Only includes early day motions signed on or before this
date. Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with information on the tibbles signed, sponsored and/or primarily sponsored by the given MP.
## Not run: # All EDMs primarily sponsored, sponsored or signed by Mike Crockart x <- mp_edms( mp_id = 3967, primary_sponsor = TRUE, sponsor = TRUE, signatory = TRUE ) # Detailed data on all EDMs primarily sponsored by Mike Crockart y <- mp_edms( mp_id = 3967, primary_sponsor = TRUE, sponsor = TRUE, signatory = FALSE, full_data = TRUE ) ## End(Not run)
## Not run: # All EDMs primarily sponsored, sponsored or signed by Mike Crockart x <- mp_edms( mp_id = 3967, primary_sponsor = TRUE, sponsor = TRUE, signatory = TRUE ) # Detailed data on all EDMs primarily sponsored by Mike Crockart y <- mp_edms( mp_id = 3967, primary_sponsor = TRUE, sponsor = TRUE, signatory = FALSE, full_data = TRUE ) ## End(Not run)
Accepts an ID number for a member of the House of Commons, and returns a tibble of of all their oral and written questions.
mp_questions( mp_id = NULL, question_type = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_mp_questions( mp_id = NULL, question_type = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_questions( mp_id = NULL, question_type = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_mp_questions( mp_id = NULL, question_type = "all", start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_id |
The ID number of a member of the House of Commons, or a vector
of IDs. Defaults to |
question_type |
Accepts the arguments |
start_date |
Only includes questions answered on or after this date.
Accepts character values in |
end_date |
Only includes questions answered on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on all questions asked by a member of the House of Commons.
## Not run: x <- mp_questions(c(172, 3967), "all") y <- mp_questions(mp_id = 172, question_type = "all") z <- mp_questions(c(172, 3967), "written") ## End(Not run)
## Not run: x <- mp_questions(c(172, 3967), "all") y <- mp_questions(mp_id = 172, question_type = "all") z <- mp_questions(c(172, 3967), "written") ## End(Not run)
Accepts an ID number for a member of the House of Commons, and returns a tibble of their votes.
mp_vote_record( mp_id = NULL, lobby = "all", session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_mp_vote_record( mp_id = NULL, lobby = "all", session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_vote_record( mp_id = NULL, lobby = "all", session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_mp_vote_record( mp_id = NULL, lobby = "all", session = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
mp_id |
The ID number of a member of the House of Commons. |
lobby |
Accepts one of |
session |
The parliamentary session to return votes from, in
|
start_date |
Only includes divisions on or after this date. Accepts
character values in |
end_date |
Only includes divisions on or before this date. Accepts
character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on the voting record of the given MP.
## Not run: x <- mp_vote_record(172, lobby = "all") x <- mp_vote_record(172, lobby = "aye") x <- mp_vote_record(172, lobby = "no") x <- mp_vote_record(172, session = "2016/17") ## End(Not run)
## Not run: x <- mp_vote_record(172, lobby = "all") x <- mp_vote_record(172, lobby = "aye") x <- mp_vote_record(172, lobby = "no") x <- mp_vote_record(172, session = "2016/17") ## End(Not run)
Imports data on papers laid before the House.
papers_laid( withdrawn = FALSE, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_papers_laid( withdrawn = FALSE, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
papers_laid( withdrawn = FALSE, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_papers_laid( withdrawn = FALSE, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
withdrawn |
If |
house |
The house the paper was laid in. Accepts |
start_date |
Only includes papers laid before the House on or after
this date. Accepts character values in |
end_date |
Only includes papers laid before the House on or before
this date. Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on papers laid before the given House.
## Not run: x <- papers_laid(withdrawn = FALSE, house = "commons") x <- papers_laid(withdrawn = TRUE, house = NULL) ## End(Not run)
## Not run: x <- papers_laid(withdrawn = FALSE, house = "commons") x <- papers_laid(withdrawn = TRUE, house = NULL) ## End(Not run)
Imports data on House of Commons and House of Lords publications.
publication_logs( ID = NULL, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_publication_logs( ID = NULL, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
publication_logs( ID = NULL, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_publication_logs( ID = NULL, house = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
ID |
Publication ID. Defaults to |
house |
The house that produced the particular publication. Accepts
|
start_date |
Only includes publications issued on or after this date.
Accepts character values in |
end_date |
Only includes publications issued on or before this
date. Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details from publications in the House of Commons and House of Lords
## Not run: # All publications in the house of commons x <- publication_logs(house = "commons") # Returns a given publication y <- publication_logs(683267) ## End(Not run)
## Not run: # All publications in the house of commons x <- publication_logs(house = "commons") # Returns a given publication y <- publication_logs(683267) ## End(Not run)
Imports data on Parliamentary Research Briefings. To see a list of possible
topics call research_topics_list()
or
research_subtopics_list()
for both topics and subtopics. To
see a list of briefing types, call research_types_list()
. This
function can return results with newlines in the text of the abstract or
description of the research briefing, represented as '\\n'
.
research_briefings( topic = NULL, subtopic = NULL, type = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_research_briefings( topic = NULL, subtopic = NULL, type = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
research_briefings( topic = NULL, subtopic = NULL, type = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_research_briefings( topic = NULL, subtopic = NULL, type = NULL, extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
topic |
The topic of the parliamentary briefing.
Defaults to |
subtopic |
The subtopic of the parliamentary briefing.
Defaults to |
type |
The type of research briefing. Defaults to |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on parliamentary research briefings on the given topic.
## Not run: x <- research_briefings("Housing and planning") # Requests can be made using lists created using `research_topics_list` # and `research_subtopics_list` research_topics_list <- research_topics_list() x <- research_briefings(topic = research_topics_list[[7]]) research_subtopics_list <- research_subtopics_list() x <- research_briefings(subtopic = research_subtopics_list[[7]][10]) # Requests for certain briefing types can also be made using lists # created with `research_types_list`. research_types_list <- research_types_list() x <- research_briefings(type = research_types_list[[3]]) ## End(Not run)
## Not run: x <- research_briefings("Housing and planning") # Requests can be made using lists created using `research_topics_list` # and `research_subtopics_list` research_topics_list <- research_topics_list() x <- research_briefings(topic = research_topics_list[[7]]) research_subtopics_list <- research_subtopics_list() x <- research_briefings(subtopic = research_subtopics_list[[7]][10]) # Requests for certain briefing types can also be made using lists # created with `research_types_list`. research_types_list <- research_types_list() x <- research_briefings(type = research_types_list[[3]]) ## End(Not run)
Returns lists of research briefing topics, subtopics and types. These functions do not accept any arguments.
research_topics_list() hansard_research_topics_list() research_subtopics_list() hansard_research_subtopics_list() research_types_list() hansard_research_types_list()
research_topics_list() hansard_research_topics_list() research_subtopics_list() hansard_research_subtopics_list() research_types_list() hansard_research_types_list()
A list with the different research topics/subtopics/types available.
A list with the different research topics available
A list of Parliamentary Research Briefings topics
A list of types of Parliamentary Research Briefings
## Not run: research_topics_list <- research_topics_list() research_subtopics_list <- research_subtopics_list() research_types_list <- research_types_list() ## End(Not run)
## Not run: research_topics_list <- research_topics_list() research_subtopics_list <- research_subtopics_list() research_types_list <- research_types_list() ## End(Not run)
Imports data on Parliamentary Sessions. Note that due to the date format
used by the API, if days==TRUE
and the end_date
and
start_date
parameters are not set to the default values, the
function downloads all available data and then subsets the tibble
between the two given dates.
sessions_info( days = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_sessions_info( days = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
sessions_info( days = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_sessions_info( days = FALSE, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE )
days |
If |
start_date |
Only includes sessions starting on or after this date.
Accepts character values in |
end_date |
Only includes sessions ending on or before this date.
Accepts character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
A tibble with details on parliamentary sessions.
## Not run: x <- sessions_info(days = TRUE) y <- sessions_info(days = FALSE) ## End(Not run)
## Not run: x <- sessions_info(days = TRUE) y <- sessions_info(days = FALSE) ## End(Not run)
Imports data on TV broadcasts, clips of individual members and parliamentary TV channels.
tv_programmes( legislature = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_tv_programmes( legislature = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) tv_clips( mp_id = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_tv_clips( mp_id = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) tv_channels(tidy = TRUE, tidy_style = "snake", verbose = TRUE) hansard_tv_channels(tidy = TRUE, tidy_style = "snake", verbose = TRUE)
tv_programmes( legislature = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_tv_programmes( legislature = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) tv_clips( mp_id = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) hansard_tv_clips( mp_id = NULL, start_date = "1900-01-01", end_date = Sys.Date(), extra_args = NULL, tidy = TRUE, tidy_style = "snake", verbose = TRUE ) tv_channels(tidy = TRUE, tidy_style = "snake", verbose = TRUE) hansard_tv_channels(tidy = TRUE, tidy_style = "snake", verbose = TRUE)
legislature |
Accepts one of either |
start_date |
Only includes broadcasts on or after this date.
Accepts character values in |
end_date |
Only includes broadcasts on or before this date. Accepts
character values in |
extra_args |
Additional parameters and queries to pass to API. These
queries must be strings and start with "&". See the
API documentation
or the package vignette for more details. Defaults to |
tidy |
Logical parameter. If |
tidy_style |
The style to convert variable names to, if
|
verbose |
If |
mp_id |
Accepts the ID of an MP or peer, and returns all clips
featuring that MP or peer. If |
A tibble with details on TV broadcasts.
A tibble with details on TV broadcasts featuring the given MP, or all available clips.
A tibble with details on the different broadcasting channels.
TV programmse broadcast, per legislature and date
Clips of a given MP or Peer
Details on the different parliamentary TV channels
## Not run: x <- tv_programmes("commons", start_date = "2016-11-01", end_date = "2016-12-01" ) ## End(Not run) ## Not run: x <- tv_clips(4591) ## End(Not run)
## Not run: x <- tv_programmes("commons", start_date = "2016-11-01", end_date = "2016-12-01" ) ## End(Not run) ## Not run: x <- tv_clips(4591) ## End(Not run)