Description Usage Arguments Value Examples
View source: R/data_set_labels.R
Set labels to columns in a dataframe.
1 | data_set_labels(.data, .cols, .labels = NULL)
|
.data |
A dataframe |
.cols |
A character vector; Colomns to set labels to |
.labels |
A character vector; Labels for the columns. If NULL, each element of .colnames must be named with its label. |
Dataframe with labelled columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
dat <- data.frame(
age = c(23, 45),
gender = c("M", "F")
)
# Labels in a separate vector
var <- c("age", "gender")
lbl <- c("Age of participant", "Gender of participant")
data_set_labels(dat, var, lbl)
# Labels in the names of `.cols` vector
names(var) <- lbl
data_set_labels(dat, var)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.