Files may be formatted as TeX glossary file or
in yaml format suitable for reading using
yaml_as_df()
(see details).
read_glossary(file, format = guess_glo_fmt(file))
A named list of glossary definitions with class tex_glossary
and
glossary
. The list names are acronym entry labels (i.e., what you would
pass to \gls{}
when writing a tex document).
For the tex format, the glossary file is expected to contain acronym entries with the form
or
For the yaml format, the glossary file is expected to be able to be
read with yaml_as_df()
; the outer level should be the label
and
columns should be provided with the names def
(definition) and
abb
(abbreviation). See Examples.
texfile <- system.file("glo", "glossary.tex", package = "pmtables")
x <- read_glossary(texfile)
head(x)
#> ADA : anti-drug antibodies
#> AE : adverse event
#> AIC : Akaike information criterion
#> ALAG : oral absorption lag time
#> ASCII : American Standard Code for Information I...
#> AST : aspartate transaminase
x$WT
#> subject weight (WT)
x$SC
#> subcutaneous (SC)
yamfile <- system.file("glo", "glossary.yaml", package = "pmtables")
y <- read_glossary(yamfile)
head(y)
#> egfr : estimated glomerular filtration rate
#> bmi : body mass index
#> wt : weight
#> ht : height
#> cmax : maximum concentration in the dosing inte...
#> cmin : minimum concentration in the dosing inte...
# Format of the tex glossary file
head(readLines(texfile))
#> [1] "%%%%%%%%% A"
#> [2] "\\newacronym{ADA}{ADA}{anti-drug antibodies}"
#> [3] "\\newacronym{AE}{AE}{adverse event}"
#> [4] "\\newacronym{AIC}{AIC}{Akaike information criterion}"
#> [5] "\\newacronym{ALAG}{ALAG}{oral absorption lag time}"
#> [6] "\\newacronym{ASCII}{ASCII}{American Standard Code for Information Interchange}"
# Format of the yaml glossary file
head(readLines(yamfile))
#> [1] "egfr:"
#> [2] " def: estimated glomerular filtration rate"
#> [3] " abb: eGFR"
#> [4] "bmi:"
#> [5] " def: body mass index"
#> [6] " abb: BMI"
yaml_as_df(yamfile)
#> # A tibble: 7 × 3
#> .row def abb
#> <chr> <chr> <chr>
#> 1 egfr estimated glomerular filtration rate eGFR
#> 2 bmi body mass index BMI
#> 3 wt weight WT
#> 4 ht height HT
#> 5 cmax maximum concentration in the dosing interval Cmax
#> 6 cmin minimum concentration in the dosing interval Cmin
#> 7 auc area under the concentration time curve AUC