var_label | R Documentation |
Add a human readable, easier to understand label as a metadata attribute to a variable or vector than the programmatic vector object name, or column name in the data frame.
## S3 method for class 'defined'
var_label(x, ...)
## S3 method for class 'dataset_df'
var_label(
x,
unlist = FALSE,
null_action = c("keep", "fill", "skip", "na", "empty"),
recurse = FALSE,
...
)
label_attribute(x)
## S3 replacement method for class 'defined'
var_label(x) <- value
## S3 replacement method for class 'dataset_df'
var_label(x) <- value
x |
a vector or a data.frame |
... |
Further potential parameters reserved for inherited classes. |
unlist |
for data frames, return a named vector instead of a list |
null_action |
for data frames, by default |
recurse |
if |
value |
a character string or |
See labelled::var_label
for details about
variable labels.
See vignette("defined", package = "dataset")
to use comprehensively
with variable labels, namespaces, units of measures, and machine-independent
permanent variable identifiers.
var_label()
returns returns the label
attribute as a character
string.
The var_label<-
assignment method allows to add, remove, or overwrite this attribute on a vector
x
. The assignment function returns the x
vector invisibly.
Other defined metadata methods and functions:
defined()
,
var_namespace()
,
var_unit()
iris_dataset_2 <- iris_dataset
# Retrieve the label attribute:
var_label(iris_dataset_2$Sepal.Length)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.