Skip to contents

Downloads a paper corpus RDS file from the scienceverse/papers GitHub repository and loads it into R as a paperlist object. By default the file is downloaded to a temporary location and discarded after loading, which is the right choice for one-off use. Set cache = TRUE to save it permanently in the user data directory instead, so subsequent calls reuse the cached copy rather than re-downloading. Use papers_remove() to delete a cached corpus.

Usage

papers_load(
  name,
  repo = "scienceverse/papers",
  cache = FALSE,
  overwrite = FALSE
)

Arguments

name

name of the corpus, without the .rds extension (see papers_available())

repo

GitHub repository in "owner/repo" format; a private repository needs a GitHub token with access to it (see github_pat())

cache

whether to save the corpus to the user data directory for reuse across sessions, instead of downloading it fresh each time

overwrite

whether to re-download if already cached (only relevant when cache = TRUE)

Value

a paperlist object

Details

A corpus in a private repository (such as scienceverse/papers_private) is read with the GitHub token github_pat() returns, which needs access to that repository.

Examples

# \donttest{
if (online("api.github.com")) {
  # GitHub can refuse when its request limit is reached; then this says why
  collabra <- tryCatch(papers_load("collabra"),
                       error = function(e) message(conditionMessage(e)))
}
#> Downloading collabra (31.7 MB) ...
#> Loading collabra ...
# }