design_expand {lazy.tools} | R Documentation |
Dummy Expantion of a Vector
design_expand(
x,
type = 0,
drop = "last",
levels = NULL,
froot = "level",
sort = 0
)
x |
a vector to be expanded |
type |
= -1 for non-full-rank design matrix used in SAS proc GLM |
drop |
= "last" or "first" when type != -1 |
levels |
= a string vector consisting of the labels for the levels |
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. |
By default, the zero-sum design matrix with the last level dropped will be generated.
Design matrix of the size length(x) times length(factor(x)) or length(x) times length(factor(x))-1
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( c("a","b","c"), levels=c("c","a","b"), type=-1 )
design_expand( 1:3, type=0 )
design_expand( c("a","b","c"), froot="A" )