convertToCat {iNZightTools} | R Documentation |
Convert specified numeric variables into factors
convertToCat(.data, vars, names = paste(vars, "cat", sep = "."))
.data |
a dataframe with the categorical column to convert |
vars |
a character vector of numeric column names to convert |
names |
a character vector of names for the created variable(s) |
original dataframe containing a new column of the converted numeric variable with tidyverse code attached
Owen Jin
converted <- convertToCat(iris, vars = c("Petal.Width"))
cat(code(converted))
head(converted)