powered by
Creates a design matrix by expanding factors to a set of dummy variables.
model_matrix(DT, ColNameFactor, other_class)
a data table contains the factors and the response.
a char vector with the name of the selected factor.
a char vector with the name of other classes than numeric (factor or char).
return the value.
# NOT RUN { library(data.table) data(example_data) m = model_matrix (example_data, colnames(example_data)[-c(1:3)], other_class = colnames(example_data)[14:23]) print(m) # }
Run the code above in your browser using DataLab