| na_range_to_values {retroharmonize} | R Documentation |
Harmonize user-defined missing value ranges
Description
Harmonize the na_values attribute with
na_range, if the latter is present.
Usage
na_range_to_values(x)
is.na_range_to_values(x)
Arguments
x |
A labelled_spss or labelled_spss_survey vector |
Details
na_range_to_values() tests if the function needs to be
called for na_values harmonization. The na_range
is often missing and less likely to cause logical problems
when joining survey answers.
Value
A x with harmonized na_values and
na_range attributes.
If min(na_values) or max(na_values) than the left- and
right-hand value of na_range, it gives a warning and adjusts
the original na_range.
See Also
Other variable label harmonization functions:
harmonize_values(),
harmonize_waves(),
label_normalize()
Examples
var1 <- labelled::labelled_spss(
x = c(1,0,1,1,0,8,9),
labels = c("TRUST" = 1,
"NOT TRUST" = 0,
"DON'T KNOW" = 8,
"INAP. HERE" = 9),
na_range = c(8,12))
na_range_to_values(var1)
as_numeric(na_range_to_values(var1))
as_character(na_range_to_values(var1))
[Package retroharmonize version 0.2.0 Index]