View source: R/gutenberg_download.R
gutenberg_download | R Documentation |
Download one or more works by their Project Gutenberg IDs into
a data frame with one row per line per work. This can be used to download
a single work of interest or multiple at a time. You can look up the
Gutenberg IDs of a work using the gutenberg_works()
function or
the gutenberg_metadata
dataset.
gutenberg_download(
gutenberg_id,
mirror = NULL,
strip = TRUE,
meta_fields = NULL,
verbose = TRUE,
files = NULL,
...
)
gutenberg_id |
A vector of Project Gutenberg ID, or a data frame
containing a |
mirror |
Optionally a mirror URL to retrieve the books from. By
default uses the mirror from |
strip |
Whether to strip suspected headers and footers using the
|
meta_fields |
Additional fields, such as |
verbose |
Whether to show messages about the Project Gutenberg mirror that was chosen |
files |
A vector of .zip file paths. If given, this reads from the files rather than from the site. This is mostly used for testing when the Project Gutenberg website may not be available. |
... |
Extra arguments passed to |
Note that if strip = TRUE
, this tries to remove the
Gutenberg header and footer using the gutenberg_strip
function. This is not an exact process since headers and footers differ
between books. Before doing an in-depth analysis you may want to check
the start and end of each downloaded book.
A two 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 columns
Integer column with the Project Gutenberg ID of each text
A character vector
library(dplyr)
# download The Count of Monte Cristo
gutenberg_download(1184)
# download two books: Wuthering Heights and Jane Eyre
books <- gutenberg_download(c(768, 1260), meta_fields = "title")
books
books %>% count(title)
# download all books from Jane Austen
austen <- gutenberg_works(author == "Austen, Jane") %>%
gutenberg_download(meta_fields = "title")
austen
austen %>%
count(title)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.