tblParts: Extract Dimensions of the Various Parts of a Table

View source: R/tblParts.bare.R

tblPartsR Documentation

Extract Dimensions of the Various Parts of a Table

Description

Extract information about the dimensions of the various parts of a table represented by a textTable or tblEntries object. This is an internal function not intended to be called by package users.

Usage

tblParts(x)

Arguments

x

A textTable object, representing a table. May also be an object containing table entries derived from a textTable object; for each entry, columns part, arow1, arow2, acol1, and acol2 are required. May also be NULL, which will be treated as a table with no entries.

Details

Currently defined table parts are "title", "subtitle", "rowhead", "colhead", "rowheadLabels", "body", "foot".

The dimensions of a part are based on the logical structure of the table, as represented in a textTable object. When x is a tblEntries or other entry-containing object, the dimensions of table parts are inferred from the numbers and positions of entries in each part. It is an error if the set of entries is not sufficiently complete that reconstruction of dimensions is unambiguous.

When inferring dimensions from a tblEntries or other entry-containing object, the display option rowheadInside is implicitly set to FALSE. Thus table parts can be assumed to be rectangular, occupying continguous blocks of cells in the table, and non-overlapping.

Internal consistency of dimensions is enforced: the number of rows for "colhead" will always be at least as large as for "rowheadLabels"; the number of columns for "rowheadLabels" and "rowhead" will be equal; the number of rows in "rowhead" and "body" will be equal; and the number of columns in "colhead" and "body" will be equal.

This function relies on undo_rowhead_inside, which uses adim.

Value

Numeric matrix with one row per table part, and columns:

nr, nc

Number of rows, columns in the part (nc equal to NA for annotation parts since the number of columns they span is determined by other table parts, rather than fixed)).

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.

Row names will be set to the part IDs.

See Also

adim for discussion of the augmented row-column grid.


tablesgg documentation built on June 22, 2024, 11:02 a.m.