Last active
October 12, 2018 11:44
-
-
Save trinker/4ccc9df173dc73c36c1b3c6dff3c42ed to your computer and use it in GitHub Desktop.
R Guttenberg API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Originally taken from: https://juliasilge.github.io/ibm-ai-day/slides.html#1 | |
if (!require("pacman")) install.packages("pacman") | |
pacman::p_load(tidyverse, gutenbergr) | |
## Scrape known books | |
titles <- c( | |
"Twenty Thousand Leagues under the Sea", | |
"The War of the Worlds", | |
"Pride and Prejudice", | |
"Great Expectations" | |
) | |
books <- gutenberg_works(title %in% titles) %>% | |
gutenberg_download(meta_fields = "title") | |
books | |
## Scrape fuzzy matched books | |
bibles <- gutenberg_works(grepl('bible', title, ignore.case = TRUE)) %>% | |
gutenberg_download(meta_fields = "title") | |
bibles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment