expand.one.level.factor | R Documentation |
Creates a design matrix like model.matrix
and fill unused missing (NA
) values with rows of 0.
expand.one.level.factor(vec, var.name = "var", comb.sep = ":", fill = NA)
vec |
factor or character vector.. |
var.name |
variable name, which will be used for generation names of newly created variables. |
comb.sep |
character, which will be used as a separator in newly created variable names between |
fill |
default value to represent missing ( |
data.frame.
model.matrix
.
vec <- c("A","B",NA,"A","C")
expand.one.level.factor(vec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.