design_expand {lazy.tools}R Documentation

Dummy Expantion of a Vector

Description

Dummy Expantion of a Vector

Usage

design_expand(x, type = 0, drop = "last", froot = "level",
  sort = 0)

Arguments

x

a vector to be expanded

type

= -1 for non-full-rank design matrix used in SAS proc GLM
= 0 for zero-sum design matrix
= 1 for drop-one-column design matrix

drop

= "last" or "first" when type != -1

froot

= A character to be used to name the columns of X matrix

sort

= 1 to sort the levels as the native factor function does.
This is the default behavior of native model.matrix function.

Details

By default, the zero-sum design matrix with the last level dropped will be generated.

Value

Design matrix of the size length(x) times length(factor(x)) or length(x) times length(factor(x))-1

Examples

design_expand( c("a","b","c") )
design_expand( c("a","xb","c") )
design_expand( c("a","b","c"), sort=1 )

design_expand( c("a","b","c"), type=-1 )
design_expand( 1:3, type=0 )
design_expand( c("a","b","c"), froot="A" )


[Package lazy.tools version 0.1.3 Index]