convert_to_cat | R Documentation |
Convert specified variables into factors
convert_to_cat(data, vars, names = NULL)
data |
a dataframe with the categorical column to convert |
vars |
a character vector of column names to convert |
names |
a character vector of names for the created variables |
original dataframe containing new columns of the converted variables with tidyverse code attached
Zhaoming Su
code
converted <- convert_to_cat(iris, vars = c("Petal.Width"))
cat(code(converted))
head(converted)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.