Design Matrix
Design Matrix.
design_matrix(x, ones = TRUE)
x |
A character vector or a factor type vector or a dataframe. Do not supply a numerical vector. |
ones |
A boolean variable specifying whether to include the ones in the design matrix or not. The default value is TRUE. |
This function implements the R's "model.matrix" function and is used only when the x is a factor/charactervector or Dataframe.
Returns the same matrix with model.matrix.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>
a <- design_matrix( iris[, 5] ) b <- model.matrix( ~ iris[,5] ) ## R's built-in function all.equal(as.vector(a),as.vector(b)) ## true a<-b<-NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.