px_variable_label {pxmake} | R Documentation |
Change VARIABLE-LABEL
Description
Inspect or change VARIABLE-LABEL.
The variable label is the name that is shown in the PX-file.
Usage
px_variable_label(x, value, validate)
## S3 method for class 'px'
px_variable_label(x, value, validate = TRUE)
Arguments
x |
A px object |
value |
Optional. A character string or data frame.
|
validate |
Optional. If TRUE a number of validation checks are performed on the px object, and an error is thrown if the object is not valid. If FALSE, the checks are skipped, which can be usefull for large px objects where the check can be time consuming. Use |
Value
A px object, a character string, or a data frame.
Examples
# Set VARIABLE-LABEL for individual variables
library(tibble)
x1 <-
px(population_gl) |>
px_variable_label(tribble(~`variable-code`, ~`variable-label`,
'gender', 'Gender',
'age', 'Age'))
px_variable_label(x1)
# Set VARIABLE-LABEL for individual languages
x2 <-
x1 %>%
px_languages(c('en', 'kl')) |>
px_variable_label(tribble(~`variable-code`, ~language, ~`variable-label`,
'gender', 'en', 'Gender',
'gender', 'kl', 'Suiaassuseq',
'age', 'en', 'Age',
'age', 'kl', 'Ukiut'))
px_variable_label(x2)
# Remove VARIABLE-LABEL
x3 <- px_variable_label(x2, NULL)
px_variable_label(x3)