value
.
replace_na(x, value, na.label = NULL)
replace_na(x, na.label = NULL) <- value
data.frame
or list
of variables where
missing values should be replaced with value
.NA
's.labels
attribute to x
).x
, where NA
's are replaced with value
.
set_na
for setting NA
values, rec
for general recoding of variables and recode_to
for re-shifting value ranges.
data(efc)
table(efc$e42dep, exclude = NULL)
table(replace_na(efc$e42dep, 99), exclude = NULL)
dummy <- list(efc$c82cop1, efc$c83cop2, efc$c84cop3)
# show original distribution
lapply(dummy, table, exclude = NULL)
# show variables, NA's replaced with 99
lapply(replace_na(dummy, 99), table, exclude = NULL)
Run the code above in your browser using DataLab