Produces a string with <col-name>: <col-definition>
format which can be
included in a table note providing a more informative definition with the
column name. The column definition can be generated from the short
name
or the label
(but note that these could frequently be the same).
ys_col_note(
.spec,
...,
.unit = FALSE,
.title_case = FALSE,
.sep = ": ",
.to_string = TRUE,
.collapse = "; ",
.width = NULL,
.type = c("short", "label")
)
a yspec object.
passed to ys_select()
.
logical; if TRUE
, then append the unit surrounded by parens
to the column definition.
logical; if TRUE
then the column definition text is
passed through tools::toTitleCase()
.
a string to separate column name and column definition; usually a space should be included as the terminal character (see default).
logical; if TRUE
, then a single string is returned.
a string to separate items when .to_string
is TRUE
;
usually a space should be included as the terminal character (see default).
if numeric
and .to_string
is TRUE
, then the result is
passed through base::strwrap()
.
selects if the column definition is generated from calling
ys_get_short()
or ys_get_label()
.
A string of length one when .to_string
is TRUE
or a character vector
if .to_string
is FALSE
.
spec <- ys_help$spec()
ys_col_note(spec, AST, ALT, SCR, .unit = TRUE)
#> [1] "AST: aspartate aminotransferase ; ALT: alanine aminotransferase ; SCR: serum creatinine (mg/dL)"