Create blocks representing groups of consecutive rows of a table, of specified size. (This is an internal utility function, not intended to be called directly by package users.)
make_rowgroups(stdblks, rowheadruns, rowgroupSize)
An S3 object of class tblBlocks
, containing (just) the newly
created row group blocks. These have type "rowblock" and subtype "G".
If rowgroupSize
is not a finite positive value, the returned object
will have no blocks (no rows).
A data frame containing the standard set of table blocks created by
tblBlocks
(without row groups). Specifically, the row header
hierarchy blocks rowblock/A/i/j
and rowblock/C/i/j
are
required, along with rowhead_and_body
.
A list with one data frame per layer of row headers (from outer to inner), containing information about the hierarchical structure of the row headers.
Numeric scalar. If not 0 or NA, blocks will be created by grouping consecutive rows of the table body into sets of this size.
This is an internal support function for tblBlocks
and
tblHvrules
. The code relies on the standard naming of table blocks
in tblBlocks
.
When a table has many rows within a given level of the row header hierarchy, the table may be easier to read if rows are grouped into smaller sets of fixed size (groups of 5, for example), with some extra space inserted between groups. To facilitate this, this function creates blocks representing such groups. The block type is "rowblock" and subtype is "G".
Grouping respects the row header hierarchy: the innermost header layer
that has runs of repeated values is identified (layer i
say), and
grouping is done separately within each of its levels. The block
representing a row group spans all columns of the table body as well as
row header layers out to layer i-1
. Block ID's have the form
rowblock/G/i/j/k
, where j
is the level number (within layer
i
) that contains the group, and k
is the group number within
that level. Thus i
, j
, and k
are the values of
headlayer
, level_in_layer
, and group_in_level
for the
block.
However if the table has no row headers, or none of the row header layers
have runs of repeated values, table rows are simply grouped into sets of
size rowgroupSize
. headlayer
and level_in_layer
will
be NA for the group blocks, and block ID's will have the form
rowblock/G///k
, where k
is the group number (and value of
group_in_level
).
tblBlocks
; headerRuns
creates the list
required by argument rowheadruns
.