Download the text of a Wikisource page into a data frame using its url.

wikisource_page(wikiurl, page = NA, cleaned = TRUE)

Arguments

wikiurl

The url of a Wikisource page that will be downloaded.

page

A string naming the Wikisource page downloaded.

cleaned

A boolean variable for cleaning the Wikisource page.

Value

A four column tbl_df (a type of data frame; see tibble or dplyr packages) with one row for each line of the text or texts, with four columns.

text

A character column

page

A column naming the page downloaded

language

A character column with a two letter string refering to the language of the text

url

A character column with the url of the Wikisource page of the text

Examples

if (FALSE) { # download Sonnet 18 of Shakespeare wikisource_page("https://en.wikisource.org/wiki/Shakespeare%27s_Sonnets/Sonnet_18", "Sonnet 18") # download Sonnets 116, 73 and 130 of Shakespeare library(purrr) urls <- paste0("https://en.wikisource.org/wiki/Shakespeare%27s_Sonnets/Sonnet_", c(116, 73, 130)) sonnets <- map2_df(urls, paste0("Sonnet ", c(116, 73, 130)), wikisource_page) }