Overwrites an excel file with three sheets: template, dictionary, and values.
add_dictionary_sheets(template_xlsx_path, annotations)
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. |
template_xlsx_path
if (FALSE) { # 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) }