add_dictionary_sheets: Add Dictionary Sheets

View source: R/metadata-template-dictionary.R

add_dictionary_sheetsR Documentation

Add Dictionary Sheets

Description

Overwrites an excel file with three sheets: template, dictionary, and values.

Usage

add_dictionary_sheets(template_xlsx_path, annotations)

Arguments

template_xlsx_path

Path to existing Excel template. Template is expected to have at least the first sheet with template column headers.

annotations

Data frame of annotation dictionary. Required to have the columns: key, description, value, valueDescription, source.

Value

template_xlsx_path

Examples

## Not run: 
# Annotations example
annots <- data.frame(
  key = c("first_name", "last_name", "last_name", "age"),
  description = c(
    "A person's given name",
    "A person's family name",
    "A person's family name",
    "A person's age"
  ),
  value = c(NA, "Smith", "Robinson", NA),
  valueDescription = c(
    NA,
    "From the Smith family",
    "From the Robinson family",
    NA
  ),
  source = c(NA, "Self-defined", "Self-defined", NA)
)

# Need file with template sheet to exist
template_path <- "./my_template.xlsx"
template <- data.frame(
  first_name = NA,
  last_name = NA,
  age = NA
)
writexl::write_xlsx(template, template_path)

# Add extra sheets and overwrite file
add_dictionary_sheets(template_path, annots)

## End(Not run)

Sage-Bionetworks/dccvalidator documentation built on May 7, 2022, 10:32 a.m.