Learn R Programming

cdparcoord (version 1.0.1)

makeFactor: Change numeric variables factors.

Description

Change numeric variables that are specified in varnames to factors so that discretize won't partition.

Usage

makeFactor(df, varnames)

Arguments

df

Input data frame.

varnames

Names of variables to be converted to factors.

Examples

Run this code
# NOT RUN {
data(prgeng)
pe <- prgeng[,c(1,3,5,7:9)]
class(pe$educ)  # integer
pe <- makeFactor(pe,c('educ','occ','sex'))
class(pe$educ)  # factor
# nice to give levels names
levels(pe$sex) <- c('male','female')
head(pe$sex)
# }

Run the code above in your browser using DataLab