Learn R Programming

wikiTools (version 1.2.14)

extractWiki: Extract the first paragraph of a Wikipedia article with a maximum of characters.

Description

Extract the first paragraph of a Wikipedia article with a maximum of characters.

Usage

extractWiki(
  names,
  language = c("en", "es", "fr", "de", "it"),
  plain = FALSE,
  maximum = 1000
)

Value

a character vector with html formatted (or plain text) Wikipedia paragraphs.

Arguments

names

A vector of names, whose entries have to be extracted.

language

A vector of Wikipedia's languages to look for. If the article is not found in the language of the first element, it search for the followings,.

plain

If TRUE, the results are delivered in plain format.

maximum

Number maximum of characters to be included when the paragraph is too large.

Author

Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/

Examples

Run this code
if (FALSE) {
## Obtaining information in English Wikidata
names <- c("William Shakespeare", "Pedro Almodovar")
info <- getWikiInf(names)
info$text <- extractWiki(info$label)
}

Run the code above in your browser using DataLab