textTable: Create a Structure Representing a 2D Table

Description Usage Arguments Details Value See Also

View source: R/textTable.bare.R

Description

Create a structure representing the content and organization of a 2D table: table body, row and column headers, and annotation. All table cells are formatted as character strings. This is an S3 generic.

Usage

1

Arguments

x

Object to be formatted as a 2D table.

...

Additional arguments passed to specific methods.

Details

textTable objects are the fundamental structure used to represent table _content_ and _organization_ in the tablesgg package.

Components body, rowhead, rowheadLabels, colhead, title, subtitle, and foot correspond to the table _parts_ with those names. Empty parts should be of type character: either a 0-length vector or a matrix with one or both dimensions equal to 0, depending on the component.

Character strings representing table content may be prefixed with either "MATH_" or "MKDN_". The former indicates the string is to be interpreted as a plotmath expression, the latter that the string contains markdown or HTML tags.

Components partdim, rowhier, and colhier are automatically derived from the other components whenever a textTable is created or updated.

See Appendix A of the package vignette for more information about writing textTable methods.

Value

An object with S3 class textTable. This is a list with components:

body

Character matrix containing the body of the table.

rowhead

Character matrix with the same number of rows as the table body, containing row headers for the table. Row headers are displayed as a set of columns to the left of the table body. May be empty (0 columns).

rowheadLabels

Character matrix with as many columns as rowhead and at most one row, specifying labels for the rowhead columns. May be empty (0 rows).

colhead

Character matrix with the same number of columns as the table body, containing column headers for the table. Column headers are displayed as a set of rows above the table body. If rowheadLabels are present, colhead must have at least one row, but otherwise it may be empty (0 rows).

title, subtitle, foot

Character vectors providing annotation for the table. May be empty (length 0).

partdim

Numeric matrix with one row per table part (i.e., the components listed above), and columns:

nr, nc:

Number of rows, columns in the part (nc equal to NA for annotation parts).

arow1, arow2, acol1, acol2:

First and last rows, first and last columns occupied by the part within the table's augmented row-column grid. arow* should be NA if nr is 0, acol* should be NA if nc is 0.

rowhier, colhier

Lists describing the hierarchical structure of row and column headers, respectively. Each list has one component per header layer (column of rowhead, row of colhead), in order from outermost layer to innermost. In turn, each of these components is a data frame with one row per node in the hierarchy at that layer.

Components body, rowhead, and colhead will each have an attribute type. For body this will be a character matrix with the same dimensions, containing an arbitrary string describing the type of value represented in each cell (e.g., "numeric"), or NA. For rowhead and colhead, it will be a character vector with length equal to the number of layers of headers (i.e., number of columns in rowhead, number of rows in colhead), again containing a string describing the type of values in each layer, or NA.

Components body, rowhead, rowheadLabels, colhead, title, subtitle, and foot will each have an attribute justification. It will be a character matrix or vector of the same size and shape as the component. Values "l", "c", "r" specify left, centered, and right horizontal justification of text, respectively, for the corresponding table entry. Value NA means that the type of justification is not specified–it will be set by the entry style used when plotting the table.

See Also

Specific methods for creating textTable's from other objects.


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