| Matrix-class {Matrix} | R Documentation |
The Matrix class is a class contained by all actual
classes in the Matrix package. It is a “virtual” class.
Common to all matrix objects in the package:
Dim:"integer" - the dimensions
of the matrix - must be an integer vector with exactly two
non-negative values.Dimnames:character vector length
equal the corresponding Dim element.signature(x = "Matrix"): extract matrix dimensions
dim.signature(x = "Matrix"): extract
dimnames.signature(x = "Matrix", value = "list"): set
the dimnames to a list of length 2, see
dimnames<-.signature(object = "Matrix"): show
method for printing.signature(x = "Matrix"): the same as
as(x, "matrix"); see also the note below.signature(x = "Matrix", mode = "missing"):
as.vector(m) should be identical to as.vector(as(m,
"matrix")), implemented more efficiently for some subclasses.
Loading the Matrix namespace “overloads”
as.matrix and as.array in the base
namespace by the equivalent of function(x) as(x, "matrix").
Consequently, as.matrix(m) or as.array(m) will properly
work when m inherits from the "Matrix" class —
also for functions in package base and other packages.
E.g., apply or outer can therefore be applied
to "Matrix" matrices.
Douglas Bates bates@stat.wisc.edu and Martin Maechler
dgeMatrix-class, dgCMatrix-class, and
Matrix for construction (and examples).
slotNames("Matrix")
cl <- getClass("Matrix")
names(cl@subclasses) # more than 40 ..
showClass("Matrix")#> output with slots and all subclasses