R/lama_rename.R
lama_rename.Rd
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.
lama_rename(.data, ...) # S3 method for lama_dictionary lama_rename(.data, ...) lama_rename_(.data, old, new) # S3 method for lama_dictionary lama_rename_(.data, old, new)
.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. |
The updated lama_dictionary class object.
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()
# 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#> #> --- lama_dictionary --- #> Variable 'country': #> uk fr NA_ #> "United Kingdom" "France" "other countries" #> #> Variable 'lang': #> en fr #> "English" "French" #> #> Variable 'res': #> 1 2 3 #> "Very good" "Good" "Not so good" #>## 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#> #> --- lama_dictionary --- #> Variable 'country': #> uk fr NA_ #> "United Kingdom" "France" "other countries" #> #> Variable 'lang': #> en fr #> "English" "French" #> #> Variable 'res': #> 1 2 3 #> "Very good" "Good" "Not so good" #>