textTable.matrix: Create a 'texttable' from a Matrix

Description Usage Arguments Value Examples

View source: R/textTable_methods.bare.R

Description

Create a textTable object from a matrix.

Usage

1
2
3
## S3 method for class 'matrix'
textTable(x, rcnames=c(TRUE, TRUE), title=character(0), 
    subtitle=character(0), foot=character(0), na="NA", ...)

Arguments

x

A matrix.

rcnames

A logical or character vector of length 2. The first element applies to rows, the second to columns. If FALSE, row/column names are not included. If TRUE and x has row/column names, they are included as a row/column header. Further, if the row/column dimension itself has a non-empty name, it is included as an additional, outer row/column header layer. A character string is treated the same as TRUE, except that the string is used as the dimension name (and thus an empty string will not create an outer header layer).

title, subtitle, foot

Optional character vectors providing annotation for the table. May be empty (i.e., character(0), the default).

na

Character string used to represent missing values (NAs) in the body of the table.

...

Additional arguments passed to format(x, ...).

Value

An object with S3 class textTable. The body of the table will contain the matrix values, after formatting x with format(x, ...). Row and column names may be included as headers, depending on argument rcnames.

Examples

1
2
3
4
5
6
7
8
9
data(iris, package="datasets")
mat <- data.matrix(subset(iris, Species == "setosa")[, 1:4])
ttbl <- textTable(cor(mat), digits=3, title="Correlations for setosa irises")
summary(ttbl)
plt <- plot(ttbl)
# Make hvrules invisible:
propsd(plt, subset=enabled) <- element_hvrule(color=NA)
print(plt)
  

tablesgg documentation built on June 3, 2021, 1:06 a.m.