fetch_lovecraft {lovecraftr} | R Documentation |
Fetch Lovecraft's Stories from the H.P. Lovecraft Archive
Description
The 'fetch_lovecraft' function retrieves text from stories by H.P. Lovecraft from the H.P. Lovecraft Archive. If no URL is provided, it returns a data frame listing all available stories with download links. If a valid URL is given, it fetches and returns the text from that specific story.
Usage
fetch_lovecraft(url = NULL, trim = NULL)
Arguments
url |
A character string containing the URL of a specific H.P. Lovecraft story. If 'NULL', the function returns a list of available stories and their links. |
trim |
A vector of indices specifying which lines of the text to keep/trim. If 'NULL', all lines of the text are returned. |
Value
If a valid URL is provided, the function returns a data frame with two columns:
- text
A vector containing the story's text split into lines.
- title
The title of the story.
If no URL is provided, the function returns a data frame with two columns:
- name
The name of the story.
- link
The URL from which the story can be downloaded.
References
H.P. Lovecraft Archive: https://www.hplovecraft.com/.
Examples
#' # List all available stories
fetch_lovecraft()
# Retrieve a story
fetch_lovecraft("https://www.hplovecraft.com/writings/texts/fiction/mm.aspx")