R/get_corpus.R

Defines functions get_corpus

Documented in get_corpus

#' Get corpus
#'
#' This function provides an alternative to accessing corpora
#' like \code{hcorp::classical_1}.
#' Instead, the same corpus can be accessed by calling
#' \code{get_corpus("classical_1")}.
#' @param name (Character scalar) Name of the corpus to access.
#' @export
get_corpus <- function(name) {
  checkmate::qassert(name, "S1")
  env <- new.env()
  utils::data(list = name, package = "hcorp", envir = env)
  as.list(env)[[1]]
}
pmcharrison/hcorp documentation built on March 16, 2023, 8:46 a.m.