get_portrait {legislatoR} | R Documentation |
Fetch 'Portrait' table
Description
Fetches portrait urls of legislators for the specified legislature. Requires a working Internet connection.
Usage
get_portrait(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 (varies by legislature):
pageid: Wikipedia page ID identifying a legislator's Wikipedia biography (of class ‘integer’).
image_url: URL linking to a legislator's portrait on Wikimedia Commons (of class ‘character’).
Value
A data frame with columns as specified above.
Source
Wikipedia API, https://en.wikipedia.org/w/api.php
Wikimedia Commons, https://commons.wikimedia.org/wiki/Main_Page
Examples
# Get entire 'Portraits' table for the United States Senate
usa_portraits <- get_portrait(legislature = "usa_senate")
tibble::glimpse(usa_portraits)
# Get 'Portraits' table for Democratic members of the United States Senate
usa_port_subset <- dplyr::semi_join(x = usa_portraits,
y = dplyr::filter(get_political(legislature = "usa_senate"),
party == "D"),
by = "pageid")
tibble::glimpse(usa_port_subset)
[Package legislatoR version 1.1.0 Index]