factorall: Factorize one or more variables in a data frame

Description Usage Arguments Value Author(s) Examples

Description

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

Usage

1

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

1
2
3
4
5
6
7
8
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)

erpR documentation built on June 7, 2019, 3 a.m.