make_abbrev_footnote: Make footnotes of abbreviations

View source: R/table1c.R

make_abbrev_footnoteR Documentation

Make footnotes of abbreviations

Description

This higher order function can be used to generate functions to produce strings that are suitable for use as footnotes in tables (or figures) that contain abbreviations. By convention, it is required that all abbreviations appearing in a table or figure be spelled out in full in a footnote.

Usage

make_abbrev_footnote(abbrevs, sort = TRUE, sep = "; ", end = ".")

Arguments

abbrevs

Either a named list of abbreviations, where the list names are the abbreviations and the list items are the strings being abbreviated, or the name of a YAML file that contains such a list.

sort

Should the abbreviations be automatically sorted?

sep

The seperator to use between abbreviations.

end

Punctuation to appear at the end of the footnote.

Details

If an abbreviation is not found in the list, the function will generate a warning, and produce a strange HTML code that renders as a red on yellow "XXX" in the browser (to draw attention to the issue).

Value

A function that takes any number of arguments, each argument being an abbreviation to include. This function, when called, will generate the footnote string.

Examples

abbrevs <- list(
  ALP  = "alkaline phosphatase",
  ALT  = "alanine aminotransferase",
  AST  = "aspartate aminotransferase",
  BMI  = "body mass index",
  BSA  = "body surface area")

abbrev_footnote <- make_abbrev_footnote(abbrevs)
abbrev_footnote("BMI", "ALP", "ALT")

## Not run: 
abbrev_footnote("BMI", "XXX", "YYY")  # Generates a warning

## End(Not run)

certara/table1c documentation built on Oct. 12, 2022, 8:39 a.m.