Recode values into a new measurement with an explicit mapping
Source:R/recode.R
recode_studyframe.RdRecode values into a new measurement with an explicit mapping
Usage
recode_studyframe(
x,
variable,
input,
from,
to,
unmatched = c("error", "missing", "keep"),
description
)Arguments
- x
A studyframe.
- variable
A variable_spec for the new measurement.
- input
Stable identifier of the source variable.
- from
Distinct, nonmissing source codes with types compatible with input.
- to
Replacement values, one for each source code. NA is allowed.
- unmatched
How to handle other nonmissing values: error, missing, or keep. Keeping values requires the same storage type as the replacement vector. Unmapped declared missing codes must retain their missing declarations in the new variable when values are kept.
- description
Explanation of the recode. The mapping is also recorded.