REDCap_codebook_prepare: Prepare a REDCap codebook for downstream processing

View source: R/REDCap_codebook_prepare.R

REDCap_codebook_prepareR Documentation

Prepare a REDCap codebook for downstream processing

Description

Cleans HTML formatting from codebook labels and optionally filters the codebook to selected REDCap forms.

Usage

REDCap_codebook_prepare(
  codebook,
  strings_to_ignore = codebook_strings_to_ignore,
  form.filter = NULL,
  field.label = `Field Label`,
  form.col = `Form Name`
)

Arguments

codebook

A REDCap data dictionary as a data frame.

strings_to_ignore

A regular expression used in stringr::str_remove_all() to remove formatting fragments from field labels.

form.filter

Optional character vector of REDCap form names to keep.

field.label

Unquoted column containing question labels.

form.col

Unquoted column containing the form name (for filtering)

Value

A cleaned codebook tibble/data frame.

Examples

codebook_path <- system.file("ext", "DataDictionary_sleepdiary.csv",
  package = "melidosData"
)
codebook <- utils::read.csv(codebook_path, check.names = FALSE)
cleaned <- REDCap_codebook_prepare(codebook)
cleaned$`Field Label`
#compate the original one
codebook$`Field Label`

melidosData documentation built on April 22, 2026, 5:09 p.m.