FactorToNumeric: 'FactorToNumeric'

Description Usage Arguments Value See Also

View source: R/variable.R

Description

Convert a factor variable to a numeric vector (when the factor is ordered), or a matrix of indicator variables (when the factor is not ordered).

Usage

1
FactorToNumeric(x, binary = TRUE, name = NULL, remove.first = TRUE)

Arguments

x

A factor or ordered factor.

binary

Returns the factor as binary variables.

name

The name of the variable.

remove.first

Remove the first binary variable, if a binary variable is being created.

Value

a vector of length x, if x is an ordered factor; otherwise, a 0-1 matrix with number of rows equal to the length of x an number of columns equal to the number of levels in x

See Also

model.matrix


Displayr/flipTransformations documentation built on Oct. 11, 2018, 5:38 a.m.