get_chapters: get_chapters - download multiple chapters from ctext.org.

Description Usage Arguments Value Examples

View source: R/get_text.R

Description

Vectorized form of get_chapter. Download multiple chapters from a single book or multple books of your specification. Can partially download books, and can mix and match books.

Usage

1
get_chapters(book, chapter)

Arguments

book

name of book or vector of book names

chapter

name or number of chapter, or vector of chapters

Value

Returns a dataframe with 4 columns: text, book, chapter name in English, & chapter name in Chinese. In the case for the dao-de-jing, only book arg is needed. If you reach the API call limit or the connection has an error, function will retry 3 times. If still unsuccessful, an NA value will be returned in the "text" column.

Examples

1
2
3
4
5
6
7
8
9
most basic use is to call a book and a chapter
get_chapters("analects", "xue-er")
get_chapters("analects", 1)
Can accept multiple chapters in a book, e.g.
get_chapters("analects", c("xue-er", "wei-zheng"))
get_chapters("analects", 1:2)
can specify multiple books and chapters
get_chapters(c("analects", "mengzi"), c("xue-er", "liang-hui-wang-i"))
get_chapters(c("analects", "mengzi", 1:2))

Jjohn987/ctextclassics documentation built on May 20, 2019, 3:05 p.m.