| Title: | Retrieve Data from the Parliamentary Handbook of the Commonwealth of Australia |
|---|---|
| Description: | Retrieves data from the Australian Parliamentary Library's Parliamentary Handbook <https://handbook.aph.gov.au/> and returns it as tidy tables: members and senators, their parliamentary and party service, ministries, shadow ministries, committees, parties, electorates, parliaments, sitting dates, elections and two candidate preferred results. Known errors in the Handbook are flagged, and can optionally be corrected from a documented errata table. |
| Authors: | Pat Leslie [aut, cre] (ORCID: <https://orcid.org/0000-0002-9218-8981>) |
| Maintainer: | Pat Leslie <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.1 |
| Built: | 2026-11-12 22:00:11 UTC |
| Source: | https://github.com/cran/ausPH |
Results come from a copy of the Handbook stored in the package,
supplemented with results the Handbook is missing (documented in the
Note and source columns). A supplementary result is only used where the
Handbook has none for that division and year. By default, results for any
elections the Handbook has listed since the stored copy was made are added.
The date of the stored copy is in the scraped attribute of the result,
and the date of any update in the updated attribute.
get2CP(include_byelections = FALSE, update = TRUE)get2CP(include_byelections = FALSE, update = TRUE)
include_byelections |
Choose to include house by-elections. If include_byelections = TRUE, by-election results are added. |
update |
if TRUE (the default), add results for elections listed in the Handbook since the stored copy was made (three requests, plus one per new election); if FALSE, use the stored copy only. |
a tibble. pID links a candidate's party to getParties() where
the Handbook's party name matches a party exactly; otherwise it is NA.
get2CP(update=FALSE)get2CP(update=FALSE)
Data on committee memberships since 1902
getCommitteeMembers()getCommitteeMembers()
a tibble. end_date is NA for current memberships.
getCommitteeMembers()getCommitteeMembers()
All federal general elections, House by-elections and supplementary
elections, excluding elections for casual vacancies in the Senate. The
package stores a copy reconciled with the Handbook; by default, any
elections the Handbook has listed since are added to it. The date of the
stored copy is in the scraped attribute of the result, and the date of
any update in the updated attribute.
getElections( chamber = c("all", "house", "senate"), byelections = FALSE, apply_errata = FALSE, update = TRUE )getElections( chamber = c("all", "house", "senate"), byelections = FALSE, apply_errata = FALSE, update = TRUE )
chamber |
Select from c("all","house","senate") |
byelections |
Choose to include house by-elections. If byelections = TRUE, then a list of elections with by-elections and their divisions is returned. |
apply_errata |
if TRUE, replace values listed in |
update |
if TRUE (the default), add elections listed in the Handbook since the stored copy was made (two requests); if FALSE, use the stored copy only. |
a tibble. Id is the package's election identifier (used as
ElectionID in get2CP()); HandbookId is the Handbook's own
identifier, NA for elections the Handbook does not list. For elections
added by an update, FullSenateElection is NA, because the Handbook's
list of elections does not say whether an election was a double
dissolution. handbook_flag marks elections not_in_handbook and issues
listed in getErrata().
getElections(chamber="all", update=FALSE)getElections(chamber="all", update=FALSE)
Data on electorates since 1901
getElectorates()getElectorates()
a tibble
getElectorates()getElectorates()
A table of values the package has found to be wrong in the Parliamentary
Handbook, with the corrected value and the evidence for it. By default the
get* functions return the Handbook's values and only mark these rows in
their handbook_flag column; with apply_errata = TRUE they replace the
value with corrected_value.
getErrata()getErrata()
An erratum applies only while the Handbook still has handbook_value, so
once the Handbook is fixed the erratum stops having any effect.
a tibble with one row per correction: the table and row it applies
to (table, key), the field, the handbook_value, the
corrected_value, a short issue code, the evidence and its source.
getErrata()getErrata()
Data on individuals and biographical information since 1901
getIndividuals()getIndividuals()
a tibble
getIndividuals()getIndividuals()
Data on Ministers since 1901
getMinisters()getMinisters()
a tibble with one row per ministerial role. RDateStart and
RDateEnd are the dates of the role; MDateStart and MDateEnd are the
dates of the ministry.
getMinisters()getMinisters()
Data on Ministries and Governing Parties since 1901
getMinistries()getMinistries()
a tibble with one row per ministry and governing party. Ministries
for which the Handbook lists no party (e.g. the first Barton Ministry) are
kept, with Party and pID set to NA.
getMinistries()getMinistries()
Data on all listed prior occupations held (both primary and secondary)
getOccupations()getOccupations()
a tibble with one row per person and occupation
getOccupations()getOccupations()
Data on Parliamentary terms since 1901
getParliaments()getParliaments()
a tibble
getParliaments()getParliaments()
By default the whole table is retrieved from the Handbook (one request).
If the Handbook cannot be reached, or update = FALSE, the copy stored in
the package is returned instead. The date the data was retrieved is in the
scraped attribute of the result.
getParlService( chamber = c("all", "house", "senate"), apply_errata = FALSE, update = TRUE )getParlService( chamber = c("all", "house", "senate"), apply_errata = FALSE, update = TRUE )
chamber |
choose to include MPs ("house"), senators ("senate") or both ("all"). |
apply_errata |
if TRUE, replace values listed in |
update |
if TRUE (the default), retrieve the current data from the Handbook; if FALSE, use the stored copy. |
a tibble. DateEnd is NA for terms that have not ended.
handbook_flag marks rows with a known problem in the Handbook:
overlapping_term (the term starts before the member's previous term
ends), placeholder_end_date (a term that is not the member's latest has
no end date in the Handbook) and any issue listed in getErrata().
getParlService(chamber="house") # the copy stored in the package, without querying the Handbook getParlService(chamber="house", update=FALSE)getParlService(chamber="house") # the copy stored in the package, without querying the Handbook getParlService(chamber="house", update=FALSE)
Data on parties since 1901
getParties()getParties()
a tibble. Note that the Handbook gives a party a new pID when it
changes its name, and that abbreviations are not unique (three parties
use "LIB"), so Abbrev should not be used as a key.
getParties()getParties()
Returns the copy of the Handbook's party service records stored in the
package. The Handbook has no single source for these records (each
person's must be retrieved separately), so updating takes a few minutes and
is optional: with update = TRUE, the records of everyone who has joined
or served in parliament since the stored copy was taken are retrieved again.
The date of the stored copy is in the scraped attribute of the result,
and the date of any update in the updated attribute.
getPartyService(apply_errata = FALSE, update = FALSE)getPartyService(apply_errata = FALSE, update = FALSE)
apply_errata |
if TRUE, replace values listed in |
update |
if TRUE, update the stored copy from the Handbook (about 250 requests, two to three minutes). Defaults to FALSE. |
a tibble. handbook_flag marks rows with a known problem in the
Handbook: same_day_party_record (a one-day record that starts on the
same day as another party record for the same person),
placeholder_end_date (the Handbook has 1900-01-01, returned as NA) and
any issue listed in getErrata().
getPartyService()getPartyService()
Data on all listed Qualifications
getQualifications()getQualifications()
a tibble with one row per person and qualification
getQualifications()getQualifications()
Data on all listed Secondary Schools
getSchools()getSchools()
a tibble with one row per person and school, as listed in the Handbook (some entries name more than one school)
getSchools()getSchools()
Data on Shadow Ministers since 1901
getShadowMinisters()getShadowMinisters()
a tibble with one row per shadow ministerial role. RDateStart
and RDateEnd are the dates of the role; MDateStart and MDateEnd are
the dates of the shadow ministry.
getShadowMinisters()getShadowMinisters()
Dates up to the end of the stored copy come from the package; by default,
later years are retrieved from the Handbook (one request per year). The
date of the stored copy is in the scraped attribute of the result, and
the date of any update in the updated attribute.
getSittingDates(apply_errata = FALSE, update = TRUE)getSittingDates(apply_errata = FALSE, update = TRUE)
apply_errata |
if TRUE, replace values listed in |
update |
if TRUE (the default), add sitting dates after the stored copy from the Handbook; if FALSE, use the stored copy only. |
a tibble with one row per sitting date and whether each chamber
sat. handbook_flag marks dates listed in getErrata(), e.g.
chamber_did_not_sit.
getSittingDates()getSittingDates()