View source: R/formatters_var_labels.R
col_labels | R Documentation |
Get or set variable labels in a data.frame
.
col_labels(x, fill = FALSE)
col_labels(x) <- value
col_relabel(x, ...)
get_labels(...)
x |
( |
fill |
( |
value |
( |
... |
name-value pairs, where name corresponds to a variable name in |
Variable labels can be stored as a label
attribute set on individual variables.
These functions get or set this attribute, either on all (col_labels
) or some variables (col_relabel
).
In previous versions of teal.data
labels were managed with get_labels()
.
This function is deprecated as of 0.4.0
, use col_labels
instead.
For col_labels
, named character vector of variable labels, the names being the corresponding variable names.
If the label
attribute is missing, the vector elements will be
the variable names themselves if fill = TRUE
and NA
if fill = FALSE
.
For col_labels<-
and col_relabel
, copy of x
with variable labels modified.
These functions were taken from formatters package, to reduce the complexity of the dependency tree and rewritten.
x <- iris
col_labels(x)
col_labels(x) <- paste("label for", names(iris))
col_labels(x)
y <- col_relabel(x, Sepal.Length = "Sepal Length of iris flower")
col_labels(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.