rowhead_inside: Move the Outermost Layer of Row Headers Inside a Table

View source: R/rowhead_inside.bare.R

rowhead_insideR Documentation

Move the Outermost Layer of Row Headers Inside a Table

Description

Move the outermost layer of row headers inside a table, by dividing table rows into groups, with one group per level of the header. A table row is inserted above each group, containing the value of the header for that level as a label. This is an internal function, not intended to be called by package users.

Usage

rowhead_inside(x, paste_rhiLabel)

Arguments

x

A tblEntries object containing table entries.

paste_rhiLabel

Logical scalar. If TRUE the rowheadLabel for the outermost row header layer is prefixed to its levels when creating the interior labels.

Details

This function changes the expanded row-column grid of the table, so must be called early in processing, before table blocks or hvrules are created.

The first column of row headers (containing the outermost row header layer) is removed. The entries for that layer are moved to new rows inserted into the table, so instead of appearing at the left side of the table, they appear as labels (spanning all columns of the table) above groups of rows. The id, part, subpart, level_in_layer, text, type, and enabled values for those entries do not change. However headlayer is now set to 0 (since the header is now interleaved with the body of the table), multirow to FALSE, and multicolumn to TRUE (if the table has more than one column).

The textspec values of the moved entries may change if paste_rhiLabel is TRUE; an error will be raised if pasting of markdown and non-markdown text is attempted.

The rowheadLabels entry (if any) for the moved row header layer also has its headlayer set to 0, and is disabled.

Graphical properties for displaying the moved header entries can be set in the usual ways. For example, an entryStyle or props specification for entries with part == "rowhead" and headlayer == 0 will apply just to row headers that have been moved inside the table.

Value

If x has at least one layer of row headers, an updated tblEntries object, and with attribute rowheadInside set to TRUE.

If x has no row headers, or it already has row headers moved inside, it is returned unchanged.

See Also

tblEntries, undo_rowhead_inside


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