use_labels | R Documentation |
Use the data labels of a variable instead of its values
use_labels(tbl, dict, vars = NULL, ignore_case = F, check = TRUE, warn = TRUE)
tbl |
data.frame: Data.frame with the data |
dict |
data.frame: Dictionary with all the data labels to use if they
have not yet been assigned. See |
vars |
character: If specified, only labels are assigned to those variables |
ignore_case |
logical: Indicate if case sensitive should be ignored |
check |
logical: If TRUE (default), the function will check if values present in variable are valid data labels in dictionary. |
warn |
logical: Indicate if warnings should be shown. |
This function assumes that the data labels have been assigned to the
data before, unless a dict
is supplied, in which case the latter
will be used to assign and use the data labels.
The data supplied in the tbl
argument, but instead of values
using the corresponding data labels
Data labels vignette("labeler", package = "labeler")
## Not run:
dict <- list(
SEX = list(
lab = "Sex of the person",
labs = c(
"Man" = 1,
"Woman" = 2
)
)
)
enft <- data.frame(SEX = c(1, 2))
enft
use_labels(enft, dict = dict)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.