make_header_entries {tablesgg} | R Documentation |
Convert a Matrix of Headers to Table Entries, with Merging of Runs
Description
Given a matrix of row or column headers, create a corresponding set of table entries, optionally with runs of repeated values merged into single entries. This is an internal utility function, not intended to be called by package users.
Usage
make_header_entries(x, xhier, which_head, offset, mergeRuns)
Arguments
x |
A character matrix containing header text. The orientation and dimensions
should match those used for storing the corresponding header in
|
xhier |
List of data frames containing information about the hierarchical
structure of the header. Function |
which_head |
Character string indicating whether |
offset |
Two-element numeric vector. The first element is the offset to be added
to row numbers of |
mergeRuns |
Numeric scalar, specifying how deeply in the header hierarchy runs of
repeated values will be merged into single entries. Thus a value of 0
means no header cells will be merged, a value of 1 means only repeats in
the outermost header layer will be merged, 2 means repeats in the
outermost two layers will be merged, and so on. (Determination of
repeated values respects the header hierarchy; see |
Details
headlayer
and level_in_layer
in the returned data frame are
based on xhier
, which is not affected by mergeRuns
. Thus
when mergeRuns
is less than the number of header layers (so some
runs are not merged), there may be multiple entries with the same
headlayer
and level_in_layer
values. Entry ID's will be
unique however.
Value
A data frame with a row for each header entry, and most of the columns
needed for a tblEntries
object. It has an additional attribute
i,j
which is a two-column matrix containing the row and column
numbers in x
associated with each entry. (Minimum i, j values are
used for entries that span multiple rows or columns.)
See Also
headerRuns
; tblEntries
and
tblBlocks
(which use this function)