check_and_translate_all {labelmachine}R Documentation

Check and translate function used by lama_translate_all() and lama_to_factor_all()

Description

Check and translate function used by lama_translate_all() and lama_to_factor_all()

Usage

check_and_translate_all(.data, dictionary, prefix, suffix, fn_colname,
  keep_order, to_factor, is_translated, err_handler)

Arguments

.data

Either a data frame, a factor or a vector.

dictionary

A lama_dictionary object, holding the translations for various variables.

prefix

A character string, which is used as prefix for the new column names.

suffix

A character string, which is used as suffix for the new column names.

fn_colname

A function, which transforms character string into a new character string. This function will be used to transform the old column names into new column names under which the labeled variables will then be stored.

keep_order

A logical of length one, defining if the original order (factor order or alphanumerical order) of the data frame variables should be preserved.

to_factor

A logical of length one, defining if the resulting labeled variables should be factor variables (to_factor = TRUE) or plain character vectors (to_factor = FALSE).

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


[Package labelmachine version 1.0.0 Index]