expand.two.level.factor | R Documentation |
Create data.frame containing columns corresponding to first part of two-level factor and values equal to the second part of the latter.
expand.two.level.factor(
vec,
split = "",
var.name = "var",
comb.sep = ":",
fill = NA
)
vec |
vector of two-level factor or character variable. Each element is represented as at least two-letter string. |
split |
character, which will be used to split |
var.name |
name of variable, 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.
vec <- c("A1","B4",NA,"A4","C2")
expand.two.level.factor(vec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.