Hadoop Online Training by Edureka

modelMatrix-class: Class "modelMatrix" and SubClasses

Description Objects from the Classes Slots Extends Methods Author(s) See Also Examples

Description

The class "modelMatrix" and notably its subclass "dsparseModelMatrix" are used to encode additional information, analogously to what the standard R function model.matrix() returns.

Objects from the Classes

Only "dsparseModelMatrix" and "ddenseModelMatrix" are “actual” (aka non-virtual) classes. For these, objects can be created by calls of the form new("dsparseModelMatrix", x, assign, contrast), where x is a dgCMatrix classed object.

Slots

The "modelMatrix" mother class contains Matrix plus two extra slots,

assign:

"integer" vector of length ncol(.), coding the variables which make up the matrix columns, see model.matrix.

contrasts:

a named list of contrasts, as in model.matrix().

Dim:

integer vector of length two with the matrix dimensions.

Dimnames:

list of length two, the dimnames(.) of the matrix.

whereas the (current only) actual classes "d*ModelMatrix", have an at least an additional (numeric slot "x". E.g., "dsparseModelMatrix" has the additional slots

i,p:

row number and “pointer” integer vectors, see class "dgCMatrix".

x:

"numeric" vector of non-zero entries.

factors:

a (possibly empty) list of factorizations.

Extends

"dsparseModelMatrix" extends class "dgCMatrix" directly,
"ddenseModelMatrix" extends class "dgeMatrix" directly.

Methods

show

signature(object = "modelMatrix"): show(.) the matrix, but also the assign and contrasts slots.

print

signature(x = "modelMatrix"): as show(), however (via ...) allowing to pass further arguments for printing the matrix.

Author(s)

Martin Maechler

See Also

sparse.model.matrix will return a "dsparseModelMatrix" object. model.Matrix which is a simple wrapper around the traditional model.matrix and returns a "ddenseModelMatrix" object.

Examples

1
2
3
4
showClass("modelMatrix")
showClass("dsparseModelMatrix")

## see   example(model.Matrix)


Search within the MatrixModels package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.