View source: R/design_matrix.R
Design Matrix | R Documentation |
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>
model.matrix
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.