powered by
Helper Function to Create Logical Design Matrix from Factor Variable.
h_get_design_mat(df, .var)
The logical matrix with dummy encoding of all factor levels.
(data.frame) including a factor variable with name in .var.
data.frame
.var
(string) name of the factor variable.
string
h_get_design_mat(df = data.frame(a = factor(c("a", "b", "a"))), .var = "a")
Run the code above in your browser using DataLab