Skip to contents

Translate "wrong" values from a column according to a given mapping table. Only the values that appear in the mapping table in the column "from" are translated to the corresponding "to" value. If a value is not in occurs in the mapping table, the original value is preserved. You can use this function to fix incorrectly encoded values.

Usage

mapping_fix(
  x,
  mapping_table = NULL,
  mapping_table_name = NULL,
  merge_original = T
)

Arguments

x

The vector to be translated.

mapping_table

The mapping table: a data frame with the columns "from" and to". The classes of these columns must be equal to the class of the specified "x".

mapping_table_name

The name of the mapping table in folder Mapping Tables fix/ without .csv

merge_original

If TRUE, original values are also returned if they cannot be mapped. if FALSE only the mapped values will be returned.

See also