factorall {erpR}R Documentation

Factorize one or more variables in a data frame

Description

A convenience function to transform on or more variables of a data frame into factors.

Usage

factorall(x)

Arguments

x

one or more data frame columns to be transformed into factor.

Value

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.

Author(s)

Giorgio Arcara.

Examples


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)



[Package erpR version 0.4.1 Index]