Skip to contents

This function generates a formatted bibliography of measures used in a study, including details about questions and citations.

Usage

boilerplate_report_measures(
  all_vars = NULL,
  baseline_vars = NULL,
  exposure_var = NULL,
  outcome_vars = NULL,
  measure_data,
  custom_titles = NULL,
  print_keywords = FALSE,
  print_waves = FALSE
)

Arguments

all_vars

A character vector of all variable names, or TRUE to use all variables from baseline_vars, exposure_var, and outcome_vars. If NULL, the function will use the variables provided in baseline_vars, exposure_var, and outcome_vars.

baseline_vars

A character vector of baseline variable names. Ignored if all_vars is not NULL.

exposure_var

A character string of the exposure variable name. Ignored if all_vars is not NULL.

outcome_vars

A character vector of outcome variable names. Ignored if all_vars is not NULL.

measure_data

A list containing information about each measure. The list should include elements such as "description" and "reference" for each variable.

custom_titles

A named list of custom titles for variables (optional). The names should match the variable names in all_vars.

print_keywords

Logical, whether to print keywords for each measure (default: FALSE).

print_waves

Logical, whether to print wave information for each measure (default: FALSE).

Value

A character string containing the formatted bibliography, suitable for inclusion in a Markdown document.

Examples

# Example 1: Using separate variable lists
baseline_vars <- c("age", "male_binary", "parent_binary")
exposure_var <- "political_conservative"
outcome_vars <- c("smoker_binary", "hlth_bmi", "log_hours_exercise",
                  "hlth_fatigue", "kessler_latent_anxiety",
                  "belong", "neighbourhood_community")

# Assuming measure_data is a list with information about each variable
appendix_text_1 <- boilerplate_report_measures(
  baseline_vars = baseline_vars,
  exposure_var = exposure_var,
  outcome_vars = outcome_vars,
  measure_data = measure_data
)
#> Error: object 'measure_data' not found

# Example 2: Using all_vars
all_vars <- c(baseline_vars, exposure_var, outcome_vars)
appendix_text_2 <- boilerplate_report_measures(
  all_vars = all_vars,
  measure_data = measure_data
)
#> Error: object 'measure_data' not found

# Example 3: Using custom titles and printing keywords
custom_titles <- list(age = "Participant Age", male_binary = "Gender (Male)")
appendix_text_3 <- boilerplate_report_measures(
  all_vars = all_vars,
  measure_data = measure_data,
  custom_titles = custom_titles,
  print_keywords = TRUE
)
#> Error: object 'measure_data' not found