election_results: Imports data on general election and by-election results

Description Usage Arguments Value Examples

View source: R/election_results.R

Description

Imports data on general election and by-election results

Usage

1
2
3
election_results(ID = NULL, calculate_percent = FALSE,
  constit_details = FALSE, extra_args = NULL, tidy = TRUE,
  tidy_style = "snake_case")

Arguments

ID

Accepts an ID for a general or by-election from the 2010 general election onwards, and returns the results. If NULL, returns all available election results. Defaults to NULL.

calculate_percent

If TRUE, 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 additional columns labelled 'turnout_percentage' and 'majority_percentage'. Defaults to FALSE.

constit_details

If TRUE, returns additional details on each constituency, including its GSS (Government Statistical Service) code. Defaults to FALSE.

extra_args

Additional parameters to pass to API. Defaults to NULL.

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

A tibble with the results of all general and by-elections, or of a specified general election or by-election.

Examples

1
2
3
4
5
6
## Not run: 

x <- election_results(ID=382037)


## End(Not run)

hansard documentation built on June 5, 2017, 9:01 a.m.

Search within the hansard package
Search all R packages, documentation and source code