factorsplit: Transform Categorical Variables into Numeric Variables

Description Usage Arguments Value Note See Also Examples

Description

Transform each factor column of a dataframe into numeric variables.

The numeric columns are left unchanged.

Usage

1

Arguments

data

Data.frame.

Value

The data.frame data, where the factor columns are replaced by 0/1 or +1/-1 columns. The labels of the added columns are the concatenation of the name of the factor and the name of the level, with the underscore separator.

Note

When using the other functions of the package on a result of factorsplit, be careful when describing the polynomial: the number and names of the variables in the returned data.frame may be different than the genuine ones.

See Also

crpolyX, vect2polyX

Examples

1
2
3
4
a <- data.frame(V=1:3, color=c("red","green","black"),
                       temp=c("hot", "cold", "hot"))
b <- factorsplit(a)
# The columns in b are: V, color_red, color_green,  color_red, temp

sivipm documentation built on May 2, 2019, 6:41 a.m.