View source: R/na_range_to_values.R
na_range_to_values | R Documentation |
Harmonize the na_values
attribute with
na_range
, if the latter is present.
na_range_to_values(x)
is.na_range_to_values(x)
x |
A labelled_spss or labelled_spss_survey vector |
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.
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
.
Other variable label harmonization functions:
label_normalize()
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.