extractWiki {wikiTools}R Documentation

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
)

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.

Value

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

Author(s)

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

Examples

## Obtaining information in English Wikidata
names <- c("William Shakespeare", "Pedro Almodovar")
info <- getWikiInf(names)
info$text <- extractWiki(info$label)

[Package wikiTools version 1.2.4 Index]