as.matrix.tabular: Convert tabular object to matrix

Description Usage Arguments Details Value Examples

View source: R/write.R

Description

Convert a tabular object to a matrix of the strings that would print, or a matrix of values.

Usage

1
2
3
## S3 method for class 'tabular'
as.matrix(x, format = TRUE, 
    rowLabels = TRUE, colLabels = TRUE, justification = "n", ...)

Arguments

x

A "tabular" object.

format

How to format; see Details below.

rowLabels, colLabels

Whether to include the row or column labels; only used if format = TRUE.

justification

How to justify values; only used if format = TRUE.

...

Other parameters to pass to format.tabular.

Details

If format=TRUE, then a matrix of formatted strings is produced. If not, then the format argument is assumed to be a function (or name of a function passed as a character vector) to convert the list-mode matrix to another mode, e.g. as.numeric.

Value

A matrix.

Examples

1
2
3
4
5
6
7
table <-
    tabular( (Species + 1) ~ (n=1) + Format(digits=2)*
         (Sepal.Length + Sepal.Width)*(mean + sd), data=iris )

print(table)
as.matrix(table)
as.matrix(table, format=as.numeric)

tables documentation built on May 30, 2017, 4:19 a.m.

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