jailbreakr (version 0.0.1)

unmerge_headers: Unmerge headers and row labels

Description

Unmerge cells that represent hierarchical headers and row labels.

Usage

unmerge_headers(sheet, xr, horizontal = TRUE, sep = ":")

Arguments

sheet
A worksheet object
xr
A cell range (a cellranger::cell_limits object) indicating the region to collapse. This is going to be relative to the view for now, until I work out how to use the new relative references.
horizontal
Flag indicating if this a horizontal region representing headers (TRUE, the default) or a vertical region. If horizontal we collapse away vertical spaces to create a single header row. If vertical, we collapse away horizontal space to create a single row names column.
sep
The separator to use between collapsed elements. The default is a colon (:). Because of the sheets this is designed to work with, you're never going to get syntactically valid names here, so feel free to use anything. This can be multiple characters, a newline, whatever. Likely you're going to have to process these names a bit later.

Value

A character vector

Details

There is a pattern in headers where we have some number of levels of merge, most commonly:

  | -------X------- |
  |  a  |  b  |  c  |

which typically is intended to be interpreted as:

  | X:a | X:b | X:c |

The same thing happen on rows, too. I suspect that this is generalisable to more than 2 columns.

Within such header rows are either: vertically merged:

  | X | ===> | X |
  | | |

or stacked

  | X | ===> | X:a |
  | a |

or stacked and blank

  | X | or |   |  ===> | X |
  |   |    | X |

I want to write something that handles this, that can be hooked up to act as the "header" section on a view. For now, let's apply it to all cells within a range.