Design Matrix {Rfast}R Documentation

Design Matrix

Description

Design Matrix.

Usage

design_matrix(x, ones = TRUE)

Arguments

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.

Details

This function implements the R's "model.matrix" function and is used only when the x is a factor/charactervector or Dataframe.

Value

Returns the same matrix with model.matrix.

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>

See Also

model.matrix

Examples

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

[Package Rfast version 2.1.0 Index]