Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

makeDmatrix

Make sparse matrix of dummies from factor list


Description

Given a list of factors, return the matrix of dummies as a sparse matrix.

Usage

makeDmatrix(fl, weights = NULL)

Arguments

fl

list of factors.

weights

numeric vector. Multiplied into the rows.

Details

The function returns the model matrix for a list of factors. This matrix is not used internally by the package, but it's used in some of the documentation for illustrative purposes.

Value

Returns a sparse matrix.

Examples

fl <- lapply(1:3, function(i) factor(sample(3,10,replace=TRUE)))
  fl
  makeDmatrix(fl, weights=seq(0.1,1,0.1))

lfe

Linear Group Fixed Effects

v2.8-6
Artistic-2.0
Authors
Simen Gaure [aut] (<https://orcid.org/0000-0001-7251-8747>), Grant McDermott [ctb], Karl Dunkle Werner [ctb], Matthieu Stigler [ctb, cre] (<https://orcid.org/0000-0002-6802-4290>), Daniel Lüdecke [ctb]
Initial release
2021-01-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.