makeFactor {cdparcoord} | R Documentation |
Change numeric variables that are specified in varnames
to factors so that discretize
won't partition.
makeFactor(df, varnames)
df |
Input data frame. |
varnames |
Names of variables to be converted to factors. |
Norm Matloff <matloff@cs.ucdavis.edu>, Vincent Yang <vinyang@ucdavis.edu>, and Harrison Nguyen <hhnguy@ucdavis.edu>
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)