Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


iNZightTools (version 2.0.1)

convert_to_cat: Convert variables to categorical variables

Description

Convert specified variables into factors

Usage

convert_to_cat(data, vars, names = NULL)

Value

original dataframe containing new columns of the converted variables with tidyverse code attached

Arguments

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

Author

Zhaoming Su

See Also

code

Examples

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

Run the code above in your browser using DataLab