check_and_translate_df: Checks arguments and translate a data.frame

Description Usage Arguments

View source: R/lama_translate.R

Description

Checks arguments and translate a data.frame

Usage

1
2
check_and_translate_df(.data, dictionary, args, keep_order, to_factor,
  is_translated, err_handler)

Arguments

.data

Either a data frame, a factor or an atomic vector.

dictionary

A lama_dictionary object, holding the translations for various variables.

args

The list of arguments given in ... when calling lama_translate() or lama_to_factor()

keep_order

A boolean vector of length one or the same length as the number of translations. If the vector has length one, then the same configuration is applied to all variable translations. If the vector has the same length as the number of arguments in ..., then the to each variable translation there is a corresponding boolean configuration. If a translated variable in the data.frame is a factor variable, and the corresponding boolean configuration is set to TRUE, then the the order of the original factor variable will be preserved.

to_factor

A boolean vector of length one or the same length as the number of translations. If the vector has length one, then the same configuration is applied to all variable translations. If the vector has the same length as the number of arguments in ..., then the to each variable translation there is a corresponding boolean configuration. If to_factor is TRUE, then the resulting labeled variable will be a factor. If to_factor is set to FALSE, then the resulting labeled variable will be a plain character vector.

is_translated

A boolean vector of length one or the same length as the number of translations. If the vector has length one, then the same configuration is applied to all variable translations. If is_translated = TRUE, then the original variable is a character vector holding the right labels (character strings). In this case, the labels are left unchanged, but the variables are turned into factors with order given in the selected translations.

err_handler

An error handling function


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