View source: R/headerRuns.bare.R
headerRuns | R Documentation |
Identify runs of repeated values in a matrix of row or columns headers. Detection of runs respects the hierarchical structure of headers. This is an internal utility function, not intended to be called by package users.
headerRuns(x, which_head)
x |
A matrix containing table row or column headers. |
which_head |
Character scalar, "row" or "col", indicating whether |
Runs are defined cumulatively across header variables. For the outermost
variable, runs consist of consecutive duplicated values in the first
column/row of x
; for the second-outermost variable, runs are
defined by consecutive duplicated values in the first two columns/rows of
x
, and so on. (That is, the header variables are treated as a
hierarchy, with inner variables nested within outer ones.)
A list with one component per header variable in x
. Each component
is a data frame. The i
-th data frame has one row per run of values
in the i
-th header variable, with columns:
headlayer |
Header layer number, increasing from innermost (most deeply nested) to
outermost. Thus for "row" headers it is the reverse of column number in
|
level_in_layer |
Run number within the layer. Levels are numbered from 1, so this column is just the sequence from 1 to the number of rows in the data frame. |
value |
The value in |
start |
Position in |
runlen |
Length of the run (number of rows or columns). |
If x
is NULL, the returned value is also NULL. If x
has no
header variables, the returned value is an empty list, list()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.