Learn R Programming

mnis (version 0.2.7)

mnis_general_election_results: Returns an object containing list with details of the search parameter and a tibble with election results. Accepts queries on location type and name, and the start and end date to return general elections between. The API does not contain data for Norther Ireland.

Description

Returns an object containing list with details of the search parameter and a tibble with election results. Accepts queries on location type and name, and the start and end date to return general elections between. The API does not contain data for Norther Ireland.

Usage

mnis_general_election_results(location_type = "Country",
  location_name = "Great Britain", start_date = "1900-01-01",
  end_date = Sys.Date(), tidy = TRUE, tidy_style = "snake_case")

Arguments

location_type

The type of area to return information for. Accepts 'Country', 'Region', 'County', and 'Constituency'. Defaults to 'Country'.

location_name

The location to return data for. It can be the name of any Country, Region, County or Constituency. Defaults to 'Great Britain'.

start_date

Start date of search. Accepts character values in "YYYY-MM-DD" format, and objects of class Date, POSIXt, POSIXct, POSIXlt or anything else than can be coerced to a date with as.Date(). Defaults to '1900-01-01' if no date is selected.

end_date

End date of search. Accepts character values in "YYYY-MM-DD" format, and objects of class Date, POSIXt, POSIXct, POSIXlt or anything else than can be coerced to a date with as.Date(). Defaults to current date if no date is selected.

tidy

Fix the variable names in the tibble to remove special characters and superfluous text, and converts the variable names to a consistent style. Defaults to TRUE.

tidy_style

The style to convert variable names to, if tidy=TRUE. Accepts one of "snake_case", "camelCase" and "period.case". Defaults to "snake_case"

Value

Returns a list with details of the search parameter and a tibble with election results.

See Also

mnis_reference

Examples

Run this code

x <- mnis_general_election_results(location_type = 'Country', location_name = 'England',
                                 start_date = '2010-01-01', end_date = '2016-01-01')

Run the code above in your browser using DataLab