Description Usage Arguments Details Value Examples
View source: R/get_auselection.R
get_auselection()
downloads a requested non-filtered or filtered Australian elections dataset given a set of associated arguments.
1 | get_auselection(dsr, opr = "", year = 0)
|
dsr |
A character string used to request an Australian elections dataset. See Request Codes below. |
opr |
A character string used to pass a relational operator ( |
year |
A numeric value used to request a specific election year. If there is no election for a given year, returns an empty dataframe. Default value is set to 0, which returns all election years. |
byelections
requests the byelections.csv dataset.
elections
requests the elections.csv dataset.
parliaments
requests the parliaments.csv dataset.
voting_data
requests the voting_data.csv dataset.
voting_data_with_ids
requests the voting_data_with_ids.csv dataset.
An incorrect request (an argument not associated with a dataset, non-character string argument, non-relational operator, or non-numeric election year) will stop function processes and return an error message.
A console printout of arguments used with the function,
the requested complete dataset using dsr
assigned to a user variable,
or the requested dataset dsr
for a given election year or years with year
and opr
to a user assigned variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Show request codes used for arguments in function.
get_auselection("codes")
# Show in which years an election was held
get_auselection("years")
## Not run:
# Request the complete Voting Data with IDs dataset.
# Prints a tibble to the console.
with_ids_df <- get_auselection("voting_data_with_ids")
# Preview observations for the dataset.
# Prints a vector to the console.
head(with_ids_df)
# Request only values for the 1975 election from the Voting Data with IDs dataset.
with_ids_1975_df <- get_auselection("voting_data_with_ids", year = 1975)
# Preview observations for the dataset.
head(with_ids_1975_df)
# Request values for the elections within and after 1925.
with_ids_1925up_df <- get_auselection("voting_data_with_ids", opr = ">=", year = 1925)
# Preview observation for the dataset.
head(with_ids_1925up_df)
# Request values for elections from 1925 to 1975.
with_ids_25to75_df <- get_auselection("voting_data_with_ids", opr = "range", year = c(1925, 1975))
# Preview observations for the dataset.
head(with_ids_25to75_df)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.