Learn R Programming

legislatoR (version 1.1.0)

get_office: Fetch 'Offices' table

Description

Fetches political and other offices of legislators for the specified legislature. Requires a working Internet connection.

Usage

get_office(legislature)

Value

A data frame with columns as specified above.

Format

Data frame in wide format with columns (varies by legislature):

  • wikidataid: Wikidata ID identifying a legislator's Wikidata entry (of class ‘character’).

  • office_1: political or other office held by a legislator (of class ‘logical’).

  • office_2: ... (of class ‘logical’).

  • ...

Arguments

legislature

A character string specifying the three-letter country code of the legislature for which data shall be fetched. Currently one of ‘aut’, ‘can’, ‘cze’, ‘esp’, ‘fra’, ‘deu’, ‘irl’, ‘sco’, ‘gbr’, ‘usa_house’, or ‘usa_senate’.

Examples

Run this code
# Get entire 'Offices' table for the United States Senate
usa_offices <- get_office(legislature = "usa_senate")
tibble::glimpse(usa_offices)

# Get 'Offices' table for male members of the United States Senate
usa_offices_subset <- dplyr::semi_join(x = usa_offices,
                                       y = dplyr::filter(get_core(legislature = "usa_senate"),
                                                           sex == "female"),
                                         by = "wikidataid")
tibble::glimpse(usa_offices_subset)

Run the code above in your browser using DataLab