factorall {erpR} | R Documentation |
A convenience function to transform on or more variables of a data frame into factors.
factorall(x)
x |
one or more data frame columns to be transformed into factor. |
The vectors supplied are transformed into factors. Notice that if a variable is already a factor, it is updated and all unused levels are dropped.
Giorgio Arcara.
data(iris) iris2 <- iris[iris$Species!="setosa", ] levels(iris2$Species) iris2[,c("Petal.Width", "Species")]<-factorall(iris2[,c("Petal.Width", "Species")]) levels(iris2$Species) str(iris2)