Skip to contents

This function allows editing multiple fields across multiple entries in a single operation.

Usage

boilerplate_batch_edit_multi(
  db,
  edits,
  category = NULL,
  preview = FALSE,
  confirm = TRUE,
  quiet = FALSE
)

Arguments

db

List. The database to edit.

edits

List of lists. Each sub-list should contain:

  • field: The field to edit

  • new_value: The new value

  • target_entries: Which entries to edit (optional)

  • match_pattern: Pattern to match (optional)

  • match_values: Values to match (optional)

category

Character. Category to edit if db is unified.

preview

Logical. If TRUE, shows what would be changed.

confirm

Logical. If TRUE, asks for confirmation.

quiet

Logical. If TRUE, suppresses messages.

Examples

if (FALSE) { # \dontrun{
# Update multiple fields for specific entries
unified_db <- boilerplate_batch_edit_multi(
  db = unified_db,
  edits = list(
    list(
      field = "reference",
      new_value = "sibley2021",
      target_entries = c("ban_hate_speech", "born_nz")
    ),
    list(
      field = "waves",
      new_value = "1-15",
      target_entries = c("ban_hate_speech", "born_nz")
    )
  ),
  category = "measures"
)
} # }