convertToCat {iNZightTools}R Documentation

Convert numeric variables to categorical

Description

Convert specified numeric variables into factors

Usage

convertToCat(.data, vars, names = paste(vars, "cat", sep = "."))

Arguments

.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)

Value

original dataframe containing a new column of the converted numeric variable with tidyverse code attached

Author(s)

Owen Jin

See Also

code

Examples

Run examples

converted <- convertToCat(iris, vars = c("Petal.Width"))
cat(code(converted))
head(converted)


[Package iNZightTools version 1.12.2 Index]