lama_rename {labelmachine} | R Documentation |
Rename multiple variable translations in a lama_dictionary object
Description
The functions lama_rename()
and lama_rename_()
are used to rename one or more variable translations inside of a
lama_dictionary class object.
The function lama_rename()
uses non-standard evaluation,
whereas lama_rename_()
is the standard evaluation alternative.
Usage
lama_rename(.data, ...)
## S3 method for class 'lama_dictionary'
lama_rename(.data, ...)
lama_rename_(.data, old, new)
## S3 method for class 'lama_dictionary'
lama_rename_(.data, old, new)
Arguments
.data |
A lama_dictionary object, holding the variable translations |
... |
One or more unquoted expressions separated by commas. Use named arguments, e.g. |
old |
A character vector holding the names of the variable translations, that should be renamed. |
new |
A character vector holding the new names of the variable translations. |
Value
The updated lama_dictionary class object.
See Also
lama_translate()
, lama_to_factor()
, lama_translate_all()
,
lama_to_factor_all()
, new_lama_dictionary()
,
as.lama_dictionary()
, lama_select()
, lama_mutate()
,
lama_merge()
, lama_read()
, lama_write()
Examples
# initialize lama_dictinoary
dict <- new_lama_dictionary(
country = c(uk = "United Kingdom", fr = "France", NA_ = "other countries"),
language = c(en = "English", fr = "French"),
result = c("1" = "Very good", "2" = "Good", "3" = "Not so good")
)
## Example-1: Usage of 'lama_rename'
# rename translations 'result' and 'language' to 'res' and 'lang'
dict_new <- lama_rename(dict, res = result, lang = language)
dict_new
## Example-2: Usage of 'lama_rename_'
# rename translations 'result' and 'language' to 'res' and 'lang'
dict_new <- lama_rename_(dict, c("result", "language"), c("res", "lang"))
dict_new