members_search() now allows custom lucene queries, with or without wildcards.
Changed default value of
verbose parameter to
members() to fit follow changes in API structure.
Remove URL from
about column from
Fixed error in
members_search() that produced a 404 error if left empty.
Expanded test coverage
Fixed bugs where capitalised conjunctions in department names were causing queries to fail.
bill_publications() function introduced, to retrieve data on publications associated with different bills.
Transitioned from if and else statements to
if_else() functions for internal use. Also replacing
gsub() with faster
stringi functions in some cases. These changes are intended to increase speed and improve ease of maintenance.
Internal rewrites to make maintenance easier and produce a few very small increases in speed in several functions.
Fixed some typos in documentation, brought documentation into line with the recommended 80 character maximum width for each line.
Fixed bug on
constituencies() so that the
NULL default value of parameter
current works properly.
lords_sessions() returns a tibble with details of all sessions in the House of Lords between two given dates.
commons_oral_question_times() now only returns one question ID.
commons_divisions() now separates vote number from division ID, and the function no longer returns two rows to summarise a division when only one is needed.
Changes to syntax for
current parameter can now distinguish between current constituencies (
TRUE), former (
FALSE) and all constituencies (
Simplification of some internal code, which may have a marginal effect on speed, and will make maintenance and adding features easier going forward.
Switch from using
stringi for internal string processing.
sessions_info() is now faster.
verbose parameter to all functions. If
TRUE, messages displaying the progress of the API call are sent to the console.
Sped up edm details retrieval in
TRUE and there are multiple MP IDs.
Major increase in speed for
Small increase in speed for all functions.
all_answered_questions() can now handle departmental ID numbers passed as characters.
Now uses the
stringr package to remove case sensitivity from queries.
Fixed bug that prevented
lords_written_questions() from retrieving more than 500 results at a time.
mp_edms() now accepts lists and character vectors of MP IDs, and returns them all in one tibble.
mp_edms() now includes
mp_edms() to return more useful error if the requested MP does not have any Early Day Motions that meet the search parameters.
signatory parameter in
mp_edms() is now behaving properly.
General improvement to documentation
All functions have a wrapper function with the same name, but with
hansard_ prefixed. Existing names have remained untouched.
answering_body parameters to
Fixed bug in
lord_vote_record() which produced an error if requesting both lobbies, but a peer had only voted in one of the lobbies.
Fixed bug in
all_answered_questions() that wasn’t returning results when
tabling_mp_id is a parameter.
all_data parameter in
election_results() to return the number of votes cast for each party in each constituency.
election_candidates() function, which returns the name of all candidates standing in an election.
epetition_tibble() function, which returns a tibble with all epetitions submitted to parliament, subject to parameters. This function offers more flexibility for returning basic details about a group of epetitions than the existing
epetition() function, which is designed to provide more detailed information on a single epetition.
Additional URL stripping from variable values if
tabling_mp_id parameter to
Fixed bug in
members() where looking up a single member returned a tibble with two rows.
Fixed bug in
mp_edms() where additional data was not being returned if
Fixed bug in
election_results() where it did not return data if
tidy_style parameter, allowing users to decide which style of “snake_case”, “camelCase” and “period.case” they want variable names to be in, if
elections() function now accepts
end_date parameters. As the API called by the
elections() function only accepts one additional argument not included in the package (the label of the election), changed the
extra_args parameter to
label to query that argument.
tidy parameter now changes date values to POSIXct class with
as.POSIXct() when the API returns date information, or to POSIXct with the
parse_date_time from the
lubridate package where the API returns both date and time information.
tidy parameter now strips out more unneeded character strings from API response.
elections() to work with new API syntax.
hansard() functions with
end_date parameters now accept any input that can be coerced to a date with the
type parameter to
elections(), to return all elections of a particular type.
constit_details parameter to
election_result() function. If TRUE,
constit_details retrieves additional constituency details from
constituencies(), most notably including GSS code.
calculate_percent parameter to
election_result() function. If
calculate_percent calculates the turnout percentage for each constituency in the tibble and the majority of the winning candidate to one decimal place, and includes this information in the tibble in columns labelled
majority_percentage. Defaults to FALSE.
hansard() now uses tibbles instead of data frames as the data class returned from API calls.
Fixes discrepency between output displayed and vignette and actual package output (#7, @pssguy).
tidy parameter in
members_search() now does some additional tidying up.
Major re-write, breaks compatibility with previous versions, please check your code to ensure it still works with the new package, as console input functionality has been removed from all functions. These changes ensure greater consistency insyntax across the package, in both the body and formals of the functions.
If you need the old console based functions, they can be accessed through the
hansardconsole package at https://github.com/EvanOdell/hansard-console.
Changes have been made to most functions, including:
all_answered_questions(): Console interface is gone, now operates as a function with the ID for a given MP accepted as the only function parameter. Returns all answered questions if blank.
commons_answered_questions(): Changed parameter name
answered_by; improved ability to search by date, dropped console inputs.
commons_divisions(): Removed console inputs, simplified options.
commons_oral_question_times(): Simplified function, removed need for console input.
commons_oral_questions(): Simpler process, same result, more flexibility in requests
commons_answered_questions(): Removed need for console input.
commons_terms(): Simplified formals.
commons_written_questions(): Removed need for console input.
constituencies(): Simplified formals.
early_day_motions(): Changed all camelCase to snake_case.
election_results(): Removed console input, simplified formals.
elections(): Removed console input, simplified formals.
lords_attendance(): Removed console input, simplified formals.
lord_vote_record(): Removed console input, simplified formals.
lords_divisions(): Removed console input, simplified formals.
mp_edms(): Improved functionality, can now call full text of early day motions.
mp_vote_record(): Minor re-write
papers_laid(): Incorporates new features in the API
publication_logs(): Minor re-write, now includes start and end dates.
tv_channels() New function.
tv_clips(): New function, previously part of
tv_programmes(): Minor re-write, now includes ability to select legislature.
lords_attendance() function was not working. It was returning empty data frames when searching by date and failing entirely when trying to retrieve all attendance. This was due to url encoding issues, which have now been identified and fixed. (#4, @meenaparam)
In response to a request, I’ve added three new functions that allow you to request the voting record of both MPs and members of the House of Lords by using their ID as a function parameter, rather than as a console input. They are:
The option to use console input has been preserved in
commons_oral_questions(), along with other features not available in the new functions.
Provides functions to download 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. See the package documentation for details on each function and the type of data available.