lama_rename: Rename multiple variable translations in a lama_dictionary...

Description Usage Arguments Value See Also Examples

View source: R/lama_rename.R

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

1
2
3
4
5
6
7
8
9
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. new_name = old_name, to rename selected variables.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  # 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

labelmachine documentation built on Oct. 11, 2019, 9:05 a.m.