get_traffic {legislatoR} | R Documentation |
Fetch Wikipedia 'Traffic' table
Description
Fetches daily user traffic on legislators' Wikipedia biographies for the specified legislature. Requires a working Internet connection.
Usage
get_traffic(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’).
date: Date for which user traffic is recorded, from 2015-07-01 to 2018-12-31 UTC (of class ‘POSIXct’).
traffic: Daily non-unique user visits (of class ‘numeric’).
Value
A data frame with columns as specified above.
Source
Wikimedia API, https://wikimedia.org/api/rest_v1/
http://petermeissner.de:8880/
Examples
# Get entire 'Traffic' table for the Scottish Parliament
sco_traffic <- get_traffic(legislature = "sco")
tibble::glimpse(sco_traffic)
# Add Wikidataid to 'Traffic' table for the Scottish Parliament
sco_traffic_subset <- dplyr::inner_join(x = dplyr::select(get_core(legislature = "sco"),
pageid, wikidataid),
y = sco_traffic,
by = "pageid")
tibble::glimpse(sco_traffic_subset)