Skip to contents

This helper function finds all entries containing specific characters in a field. Useful for identifying which entries need cleaning.

Usage

boilerplate_find_chars(
  db,
  field,
  chars,
  exclude_entries = NULL,
  category = NULL
)

Arguments

db

List. The database to search.

field

Character. The field to check.

chars

Character vector. Characters to search for.

exclude_entries

Character vector. Entries to exclude from results.

category

Character. Category if db is unified.

Value

A named list of entries containing the specified characters.

Examples

if (FALSE) { # \dontrun{
# Find all entries with @, [, or ] in references
entries_to_clean <- boilerplate_find_chars(
  db = unified_db,
  field = "reference",
  chars = c("@", "[", "]"),
  category = "measures"
)

# Find entries but exclude specific ones
entries_to_clean <- boilerplate_find_chars(
  db = unified_db,
  field = "reference",
  chars = c("@", "[", "]"),
  exclude_entries = c("forgiveness", "special_*"),
  category = "measures"
)
} # }