translate_vector: This function relabels a vector

Description Usage Arguments Value

View source: R/lama_translate.R

Description

This function relabels a vector

Usage

1
2
translate_vector(val, translation, keep_order, to_factor, is_translated,
  err_handler)

Arguments

val

The vector that should be relabeled. Allowed are all vector types (also factor).

translation

Named character vector holding the label assignments.

keep_order

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.

to_factor

A logical flag. If set to TRUE, the the resulting labeled variable will be a factor and a plain character vector otherwise.

is_translated

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).

err_handler

An error handling function

Value

A factor vector holding the assigned labels


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