The functions lama_select() and lama_select_() pick one or more variable translations from a lama_dictionary class object and create a new lama_dictionary class object. The function lama_select() uses non-standard evaluation, whereas lama_select_() is the standard evaluation alternative.

lama_select(.data, ...)

# S3 method for lama_dictionary
lama_select(.data, ...)

lama_select_(.data, key)

# S3 method for lama_dictionary
lama_select_(.data, key)

Arguments

.data

A lama_dictionary object, holding the variable translations

...

One or more unquoted translation names separated by commas.

key

A character vector holding the names of the variable translations that should be picked.

Value

A new lama_dictionary class object, holding the picked variable translations.

See also

lama_translate(), lama_to_factor(), lama_translate_all(), lama_to_factor_all(), new_lama_dictionary(), as.lama_dictionary(), lama_rename(), 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_select' # pick the translations 'result' and 'language' # and add them to a new lama_dictionary dict_sub <- lama_select(dict, result, language) dict_sub
#> #> --- lama_dictionary --- #> Variable 'result': #> 1 2 3 #> "Very good" "Good" "Not so good" #> #> Variable 'language': #> en fr #> "English" "French" #>
## Example-2: Usage of 'lama_select_' # pick the translations 'result' and 'language' # and add them to a new lama_dictionary dict_sub <- lama_select_(dict, c("result", "language")) dict_sub
#> #> --- lama_dictionary --- #> Variable 'result': #> 1 2 3 #> "Very good" "Good" "Not so good" #> #> Variable 'language': #> en fr #> "English" "French" #>