wiki_card: Get Data from Wikipedia Card

Description Usage Arguments Value Examples

View source: R/wiki_card.R

Description

A function to extract data from the "infocards" some Wikipedia pages provide.

Usage

1
wiki_card(page, format = "long", delay = 1)

Arguments

format

Either 'long' or 'wide'. 'long' returns an output with two columns (header and data), 'wide' returns an output with a column for each data entry.

delay

Rate at which to throttle calls. There is no delay if the function is passed an HTML object (e.g. from wiki_page). Defaults to 1, can be turned off by setting to 0. Time between calls is determined by multiplying the value of this parameter with the response time by the server.

html

Either a url to a wikipediea page, or an object that contains the body of a wikipedia page (e.g. from ws_scrape_page).

Value

Returns a data_frame (tibble) that contains the data from a table with the class "infobox".

Examples

1
2
3
4
5
6
7
wiki_card("wiki/New_York_City")

# OR
# get page THEN get card

page <- wiki_page("New_York_City") # get page
wiki_card(page) # then get data from the card

niedermansam/wikiScraper documentation built on Nov. 4, 2019, 10:06 p.m.