Learn R Programming

boilerplate (version 1.3.0)

boilerplate_validate_references: Validate References in boilerplate Database

Description

Checks that all citations in the boilerplate text exist in the bibliography file.

Usage

boilerplate_validate_references(
  db,
  bib_file = NULL,
  categories = c("methods", "results", "discussion", "appendix"),
  quiet = FALSE
)

Value

List with validation results including used keys, available keys, and missing keys

Arguments

db

Database object to validate

bib_file

Path to bibliography file. If NULL, will try to download from database

categories

Character vector of categories to check. Default is all text categories.

quiet

Logical. Suppress detailed messages

Examples

Run this code
# \donttest{
# Create temporary directory for example
temp_dir <- tempfile()
dir.create(temp_dir)

# Initialise and import
boilerplate_init(data_path = temp_dir, create_dirs = TRUE, confirm = FALSE, quiet = TRUE)
db <- boilerplate_import(data_path = temp_dir, quiet = TRUE)

# Validate references
validation <- boilerplate_validate_references(db)
if (length(validation$missing) > 0) {
  warning("Missing references: ", paste(validation$missing, collapse = ", "))
}

# Clean up
unlink(temp_dir, recursive = TRUE)
# }

Run the code above in your browser using DataLab