factor2ind {survout}R Documentation

Make An Integer Matrix Out of A Factor Variable.

Description

Create an indicator matrix of dimension length(x) x (nlevels(x)-1) with the column corresponding to the baseline level removed (by default the first level is used as baseline).

Usage

factor2ind(x, baseline)

Arguments

x

a variable.

baseline

a string indicating the reference level.

Value

a matrix

Examples

x = gl(4, 2, labels = c( "A", "B", "C", "D"))
factor2ind(x)
factor2ind(x, "C")

[Package survout version 0.1.0 Index]