HH (version 2.2-17)

as.matrix.listOfNamedMatrices: Convert a list of matrices to a single matrix

Description

Convert a list of matrices to a single matrix. This function is used to improve legibility of the printed object. The as.matrix.listOfNamedMatrices display is easier to read when the rownames are very long, as in the example illustrated here. Because the default print of the matrix repeats the rownames several times, with only a few columns of the data shown in each repetition, the actual matrix structure of the data values is obscured.

Usage

## S3 method for class 'listOfNamedMatrices':
as.matrix(x, ..., abbreviate = TRUE, minlength = 4)
is.listOfNamedMatrices(x, ...,  xName=deparse(substitute(x)))
## S3 method for class 'listOfNamedMatrices':
as.data.frame(x, ...)
as.listOfNamedMatrices(x, ...,  xName=deparse(substitute(x))) 
## S3 method for class 'listOfNamedMatrices':
print(x, ...)

Arguments

Value

The result of as.listOfNamedMatrices is a list with class=c("listOfNamedMatrices", "list"). The result of as.matrix.listOfNamedMatrices is an rbind of the individual matrices in the argument list x. The rownames of the result matrix are constructed by pasting the abbreviation of the list item names with the abbreviation of the individual matrix rownames. The original names are retained as the "Subtables.Rows" attribute. The result of is.listOfNamedMatrices is logical value. print.listOfNamedMatrices prints as.matrix.listOfNamedMatrices of its argument and returns the original argument. as.data.frame.listOfNamedMatrices(x, ...) is an unfortunate kluge. The result is the original x that has NOT been transformed to a data.frame. A warning message is generated that states that the conversion has not taken place. This kluge is needed to use "listOfNamedMatrices" objects with the Commander package because Rcmdr follows its calls to the R data function with an attempt, futile in this case, to force the resulting object to be a data.frame.

See Also

likert

Examples

Run this code
data(ProfChal)

## Single matrix with long list item names and long row names
## of argument list retained as an attribute.
as.matrix.listOfNamedMatrices(ProfChal, minlength=6)

## Original list of matrices is difficult to read because
## it is displayed on too many lines.
ProfChal

Run the code above in your browser using DataLab