set_label {labelVector} | R Documentation |
Set the label of an atomic vector
Description
Variable labels are a common construct in statistical software, giving users the ability to provide plain text descriptions for variables. These descriptions can be more informative of the variable's purpose, since they need not be restricted to the naming conventions imposed on variable names.
Usage
set_label(x, ...)
## Default S3 method:
set_label(x, label, ...)
## S3 method for class 'data.frame'
set_label(x, ..., .dots = list())
Arguments
x |
An atomic vector |
... |
For the default method, arguments to pass to other methods.
For the |
label |
|
.dots |
for data frames, a named list of key-pairs mapping the variable name to the label. |
Source
Frank E Harrell Jr, with contributions from Charles Dupont and many others. (2017). Hmisc: Harrell Miscellaneous. R package version 4.0-3. https://CRAN.R-project.org/package=Hmisc
See Also
Examples
x <- 1:10
x <- set_label(x, "Integers")
x
# Set labels for variables in a data frame
mtcars2 <-
set_label(mtcars,
am = "Automatic / Manual",
mpg = "Miles per Gallon",
gear = "Number of gears")
get_label(mtcars2)