Skip to contents

Reads a file, extracts references and identifiers, and checks them. Supported formats: BibTeX/BibLaTeX (.bib), CSL-JSON (.json), RIS (.ris), EndNote XML and JATS XML (.xml), Word (.docx), PDF (.pdf), and any text-like document (.Rmd, .qmd, .tex, .md, .txt, .html), from which DOIs are scraped.

Usage

check_file(
  path,
  format = NULL,
  sources = getOption("retraction.sources", "xera"),
  offline = FALSE,
  flag_nature = c("Retraction", "Expression of Concern"),
  allow_fuzzy = TRUE,
  resolve_ids = TRUE,
  progress = TRUE,
  strict = FALSE
)

Arguments

path

One or more file paths.

format

Force a parser (e.g. "bib", "ris", "csljson", "endnote", "jats", "docx", "pdf", "text"). When NULL, inferred from the extension and, for .xml, the root element.

sources

Sources to query. A character vector of names from list_backends(), or "all". Defaults to getOption("retraction.sources", "xera").

offline

If TRUE, match against the local snapshot built by retraction_sync() instead of querying the network.

flag_nature

Notice labels that count as "flag this citation". Defaults to Retraction and Expression of Concern.

allow_fuzzy

Allow fuzzy title matching for references without a usable identifier.

resolve_ids

If TRUE, resolve PMID-only references to a DOI via OpenAlex before matching.

progress

Show a progress bar in interactive sessions.

strict

If TRUE, error when any reference cannot be checked (an unchecked row from a network or source failure) instead of returning it, so a failure cannot be mistaken for a clean result. Useful in CI.

Value

A retraction_result tibble.

Examples

# \donttest{
bib <- system.file("extdata", "example.bib", package = "retraction")
if (nzchar(bib)) check_file(bib)
#> 
#> ── retraction: 3 references checked ────────────────────────────────────────────
#>  1 retracted or flagged
#>  2 clean
#> 
#> ── Flagged citations ──
#> 
#>wakefield1998 [example.bib]: Ileal-lymphoid-nodular Hyperplasia, Non-specific
#> Colitis, and Pervasive Developmental Disorder in Children (retracted
#> 2010-02-06; source: xera)
#> 
#>  Full table: `as.data.frame(x)` or `tibble::as_tibble(x)`.
# }