R/openalexR-coverage.R

Defines functions get_coverage

Documented in get_coverage

#' Get coverage of OpenAlex fields in openalexR
#'
#' @param entity The OA entity to inspect field coverage for. Returns
#'   information for all fields if `NULL` (default).
#'
#' @return Data frame of field coverage information
#' @export
#'
#' @seealso oa_entities()
#' @examples
#' oa_entities()
#' head(get_coverage(entity = "works"))
get_coverage <- function(entity = NULL) {
  oa2df_coverage <- getExportedValue("openalexR", "oa2df_coverage")

  if (!is.null(entity)) {
    entity <- rlang::arg_match(entity, oa_entities())
    oa2df_coverage[[entity]]
  } else {
    oa2df_coverage
  }
}

Try the openalexR package in your browser

Any scripts or data that you put into this service are public.

openalexR documentation built on April 11, 2025, 6:01 p.m.