if_na | R Documentation |
Often, you want to substitute missing values with some implicit known value (e.g. if the question on number of sexual partners was skipped for sexually inactive people, you know the missing should turn into zero)
if_na(x, missing)
x |
the variable |
missing |
What to replace missing values with |
number_of_sex_partners <- c(1, 3, 5, 10, NA, 29)
if_na(number_of_sex_partners, 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.