Dimension names for NMF objects

Description

The methods dimnames, rownames, colnames and basisnames and their respective replacement form allow to get and set the dimension names of the matrix factors in a NMF model.

dimnames returns all the dimension names in a single list. Its replacement form dimnames<- allows to set all dimension names at once.

rownames, colnames and basisnames provide separate access to each of these dimension names respectively. Their respective replacement form allow to set each dimension names separately.

Usage

basisnames(x, ...)

basisnames(x, ...) <- value

S4 (NMF)
`dimnames`(x)

S4 (NMF)
`dimnames`(x) <- value

Arguments

x
an object with suitable basis and coef methods, such as an object that inherit from NMF-class.
...
extra argument to allow extension.
value
a character vector, or NULL or, in the case of dimnames<-, a list 2 or 3-length list of character vectors.

Details

The function basisnames is a new S4 generic defined in the package NMF, that returns the names of the basis components of an object. Its default method should work for any object, that has a suitable basis method defined for its class.

The method dimnames is implemented for the base generic dimnames, which make the base function rownames and colnames work directly.

Overall, these methods behave as their equivalent on matrix objects. The function basisnames<- ensures that the dimension names are handled in a consistent way on both factors, enforcing the names on both matrix factors simultaneously.

The function basisnames<- is a new S4 generic defined in the package NMF, that sets the names of the basis components of an object. Its default method should work for any object, that has suitable basis<- and coef<- methods method defined for its class.

Methods

  1. basisnamessignature(x = "ANY"): Default method which returns the column names of the basis matrix extracted from x, using the basis method.

    For NMF objects these also correspond to the row names of the coefficient matrix.

  2. basisnames<-signature(x = "ANY"): Default method which sets, respectively, the row and the column names of the basis matrix and coefficient matrix of x to value.

  3. dimnamessignature(x = "NMF"): Returns the dimension names of the NMF model x.

    It returns either NULL if no dimnames are set on the object, or a 3-length list containing the row names of the basis matrix, the column names of the mixture coefficient matrix, and the column names of the basis matrix (i.e. the names of the basis components).

  4. dimnames<-signature(x = "NMF"): sets the dimension names of the NMF model x.

    value can be NULL which resets all dimension names, or a 1, 2 or 3-length list providing names at least for the rows of the basis matrix.

    The optional second element of value (NULL if absent) is used to set the column names of the coefficient matrix. The optional third element of value (NULL if absent) is used to set both the column names of the basis matrix and the row names of the coefficient matrix.