Extend recode method from haven to
works with labelled vectors.
# S3 method for haven_labelled recode(.x, ..., .default = NULL, .missing = NULL)
| .x | A vector to modify |
|---|---|
| ... | Replacements. For character and factor When named, the argument names should be the current values to be replaced, and the argument values should be the new (replacement) values. All replacements must be the same type, and must have either
length one or the same length as These dots support tidy dots features. |
| .default | If supplied, all values not otherwise matched will
be given this value. If not supplied and if the replacements are
the same type as the original values in
|
| .missing | If supplied, any missing values in |
recode (dplyr)
#> <Labelled integer> #> [1] 1 2 3 #> #> Labels: #> value label #> 1 yes #> 2 no#> <Labelled integer> #> [1] 1 2 2 #> #> Labels: #> value label #> 1 yes #> 2 no