elections {hansard} | R Documentation |
General and By-Elections
Description
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.
Usage
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)
Arguments
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 |
Value
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).
See Also
Examples
## Not run:
x <- elections(517994)
## End(Not run)