wikisource_page: Download a page from Wikisource

Description Usage Arguments Value Examples

View source: R/wikisource_page.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# 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)

## End(Not run)

wikisourcer documentation built on Aug. 11, 2020, 5:06 p.m.