get_history: Fetch Wikipedia 'History' table

View source: R/get_history.R

get_historyR Documentation

Fetch Wikipedia 'History' table

Description

Fetches full revision histories of legislators' Wikipedia biographies for the specified legislature. Requires a working Internet connection.

Usage

get_history(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 with columns:

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

  • revid: Wikipedia edit ID (of class ‘integer’).

  • parentid: Wikipedia edit ID of the previous revision (of class ‘integer’).

  • user: Username of registered user responsible for the revision, IP address in case of anonymous revision (of class ‘character’).

  • userid: ID of registered user responsible for the revision, 0 in case of anonymous revision (of class ‘integer’).

  • timestamp: Date and time of the revision (of class ‘POSIXct’).

  • size: Revision size in bytes (of class ‘integer’).

  • comment: Revision comment (of class ‘character’).

Value

A data frame with columns as specified above.

Source

Wikipedia API, https://en.wikipedia.org/w/api.php

Examples

# Get entire 'History' table for the Austrian Nationalrat
aut_history <- get_history(legislature = "aut")
tibble::glimpse(aut_history)

# Get 'History' table for NEOS party members of the Austrian Nationalrat
aut_history_subset <- dplyr::semi_join(x = aut_history,
                                       y = dplyr::filter(get_political(legislature = "aut"),
                                                         party == "NEOS"),
                                       by = "pageid")
tibble::glimpse(aut_history_subset)


saschagobel/legislatoR documentation built on Jan. 30, 2024, 7:52 p.m.