Skip to contents

This function saves a boilerplate database to disk with entry-level change detection.

Usage

boilerplate_save(
  db,
  category = NULL,
  data_path = NULL,
  confirm = TRUE,
  create_dirs = FALSE,
  quiet = FALSE,
  entry_level_confirm = TRUE,
  create_backup = TRUE,
  select_elements = NULL,
  output_file = NULL
)

Arguments

db

List. The database to save.

category

Character. Category of the database. Options include "measures", "methods", "results", "discussion", "appendix", "template". If NULL and db is a named list matching category names, saves each category.

data_path

Character. Base path for data directory. If NULL (default), uses here::here("boilerplate", "data").

confirm

Logical. If TRUE, asks for confirmation before overwriting. Default is TRUE.

create_dirs

Logical. If TRUE, creates directories that don't exist. Default is FALSE.

quiet

Logical. If TRUE, suppresses all CLI alerts. Default is FALSE.

entry_level_confirm

Logical. If TRUE, shows changes at the entry level and asks for confirmation. Default is TRUE.

create_backup

Logical. If TRUE, creates a backup of existing database before saving. Default is TRUE.

select_elements

Character vector. Paths to select in dot notation (e.g., "statistical.longitudinal.lmtp"). Use "" for wildcard selection (e.g., "statistical." selects all statistical methods). If NULL (default), saves the entire database.

output_file

Character. Name of the output file if saving selected elements to a separate file. If NULL (default), overwrites the original file.

Value

Invisibly returns a named list with logical values indicating which categories were successfully saved, or the file path if a single category was saved.