get_political: Fetch 'Political' table

View source: R/get_political.R

get_politicalR Documentation

Fetch 'Political' table

Description

Fetches political data of legislators for the specified legislature. Requires a working Internet connection.

Usage

get_political(legislature)

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’.

Format

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

  • pageid: Wikipedia page ID identifying a legislator's Wikipedia biography (of class ‘integer’).

  • session: Legislative period (of class ‘integer’).

  • party: A legislator's party affiliation (of class ‘character’). See https://github.com/saschagobel/legislatoR for the full form of abbreviated party names and english translations of non-english party names

  • constituency: A legislator's constituency (of class ‘character’).

  • constituency2: A legislator's constituency (upper level, if applicable, of class ‘character’).

  • constituency_id: ID of a legislator's constituency (of class ‘character’).

  • session_start: Date the legislative period started (of class ‘Date’).

  • session_end: Date the legislative period ended (of class ‘Date’).

  • service: A legislator's period of service in days during the respective session (of class ‘integer’)

  • government (or similar): Indicator of a legislator's majority status in parliament (of class ‘logical’). Further columns with extensions of this might exist.

  • leader (or similar): Indicator of a legislator's leader status in parliament (of class ‘logical’). Further columns with extensions of this might exist.

Value

A data frame with columns as specified above.

Source

Wikipedia, https://www.wikipedia.org/
Czech Republic Parliamentary Members Archive https://public.psp.cz/sqw/fsnem.sqw?zvo=1
Spain Parliamentary Members Archive https://www.congreso.es/es/busqueda-de-diputados

Examples

# Get entire 'Political' table for the Czech Poslanecka Snemovna
cze_political <- get_political(legislature = "cze")
tibble::glimpse(cze_political)

# Get 'Political' table for female DSP party members of the Czech Poslanecka Snemovna
cze_political_subset <- dplyr::semi_join(x = dplyr::filter(cze_political,
                                                           party == "ODS"),
                                         y = dplyr::filter(get_core(legislature = "cze"),
                                                           sex == "female"),
                                         by = "pageid")
tibble::glimpse(cze_political_subset)


legislatoR documentation built on April 3, 2023, 5:22 p.m.