This function will map an input vector to a factor, optionally applying a lookup table. It is the core vector-level engine for harmonizing categorical data.
The signature should be:
harmonize_fct(.data, ..., .spec = NULL, lookup = NULL)
MVP Behavior:
- The function will take an input vector (
.data).
- It will apply the named vector provided in
lookup to translate values.
- If a
.spec object (from specify_fct()) is provided, it will validate the resulting values against the levels in the spec, coercing the final output to a factor.
- If
.spec is NULL, the function will perform the mapping but skip the validation, returning a factor.
This function will map an input vector to a factor, optionally applying a lookup table. It is the core vector-level engine for harmonizing categorical data.
The signature should be:
MVP Behavior:
.data).lookupto translate values..specobject (fromspecify_fct()) is provided, it will validate the resulting values against thelevelsin the spec, coercing the final output to a factor..specisNULL, the function will perform the mapping but skip the validation, returning a factor.