This function relabels a vector
translate_vector(val, translation, keep_order, to_factor, is_translated,
err_handler)
The vector that should be relabeled. Allowed are all vector types (also factor).
Named character vector holding the label assignments.
A logical flag. If the vector in val
is a factor variable and keep_order
is set to TRUE
, then
the order of the original factor variable is preserved.
A logical flag. If set to TRUE
, the the resulting
labeled variable will be a factor and a plain character vector
otherwise.
A logical flag. If is_translated = TRUE
, then
val
must be a character vector holding the right labels (character strings)
and will be turned into a factor with ordering given in the translation
(except for the case when keep_order = TRUE
).
An error handling function
A factor vector holding the assigned labels