Description Usage Arguments Details Value Note Examples
These functions allow you to embed attributes in data
so that you only need to think about them once. Some functions
may overwrite or delete attributes in data, so it is recommended
that you create a meta
data object with the build_meta function
after you have set variable labels, groups, notes, abbreviations,
and units.
1 2 3 4 5 6 7 8 9 |
data |
a data frame. |
... |
name-value pairs of variable groups and names (see examples) |
tibble_one will handle attributes of data automatically, e.g., replacing variable names with variable labels, and placing variable acronyms (i.e., abbreviations) at the bottom of the table in a footnote.
Use set_variable_labels()
to set the values that will represent
variables in table one.
Use set_variable_groups()
to change the
variables that are listed in the variable categories of table one.
Use set_variable_notes
to add descriptions of variables that will
be placed at the bottom of table one as a footnote.
Use set_variable_abbrs
to indicate what acronyms in variable
labels mean (see examples).
Use set_variable_units
to indicate the unit of measurement for
continuous variables.
For set_variable_labels
, names are variables and values are labels.
For example, writing gfr_variable
= "estimated GFR" as an input to
set_variable_labels
will set the label for gfr_variable
as the
indicated string. Since GFR is an acronym, we would also want to use
set_variable_abbrs()
and say gfr_variable = c("GFR" =
"glomerular filtration rate") (see examples).
a tibble, adorned with additional attributes based on user input.
The set_variable_labels
function in tibbleOne
is a wrapper
of the labelled function,
developed by Joseph Larmarange.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | df <- data.frame(
gfr = c(1,2,3),
sbp = c(3,2,1)
)
df <- set_variable_labels(df,
gfr = 'Estimated GFR',
sbp = 'Systolic BP'
)
df <- set_variable_units(df,
gfr = 'mL/min/1.73 m2',
sbp = 'mm Hg'
)
df <- set_variable_abbrs(df,
gfr = c("GFR" = "glomerular filtration rate", "min" = 'minute'),
sbp = c("BP" = "blood pressure")
)
df <- set_variable_notes(df,
sbp = "blood pressure was measured by trained personnel"
)
build_meta(df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.