| missing_to_cat | R Documentation |
Turn <NA> in categorical variables into "(Missing)";
numeric variables will be converted to categorical variables where numeric
values as "(Observed)" and NA as "(Missing)".
missing_to_cat(data, vars, names = NULL)
data |
a dataframe with the columns to convert its missing values into categorical |
vars |
a character vector of the variables in |
names |
a character vector of names for the new variables |
original dataframe containing new columns of the converted variables for the missing values with tidyverse code attached
Zhaoming Su
code
missing <- missing_to_cat(iris, vars = c("Species", "Sepal.Length"))
cat(code(missing))
head(missing)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.