Retrieves Gutenberg works based on specified criteria and saves the data to a CSV file.
Source:R/get_gutenberg_works.R
get_gutenberg_works.RdRetrieves Gutenberg works based on specified criteria and saves the data to a CSV file.
Usage
get_gutenberg_works(
target_dir,
lcc_subject,
birth_year = NULL,
death_year = NULL,
force = FALSE,
confirmed = FALSE
)Arguments
- target_dir
The directory where the CSV file will be saved.
- lcc_subject
A character vector specifying the Library of Congress Classification (LCC) subjects to filter the works.
- birth_year
An optional integer specifying the minimum birth year of authors to include.
- death_year
An optional integer specifying the maximum death year of authors to include.
- force
A logical value indicating whether to overwrite existing data if it already exists.
- confirmed
A logical value indicating whether to skip the confirmation prompt if the number of works is greater than 1000.
Details
This function retrieves Gutenberg works based on the specified LCC subjects and optional author birth and death years. It checks if the data already exists in the target directory and provides an option to overwrite it. The function also creates the target directory if it doesn't exist. If the number of works is greater than 1000 and the 'confirmed' parameter is not set to TRUE, it prompts the user for confirmation. The retrieved works are filtered based on public domain rights in the USA and availability of text. The resulting works are downloaded and saved as a CSV file in the target directory.
For more information on Library of Congress Classification (LCC) subjects, refer to the Library of Congress Classification Guide.