jailbreakr (version 0.0.1)

split_sheet: Classify and split sheet

Description

Classify a table into sub-regions. We're looking for a (possibly ragged) block of cells surrounded by a set of blank cells or the edge of the sheet. This does not detect regions that are multiple square regions offset from each other, but that could possibly be done afterwards.

Usage

split_sheet(sheet)
split_sheet_find(sheet)
split_sheet_apply(sheet, limits)

Arguments

sheet
A linen worksheet object, possibly from an Excel or googlesheets spreadsheet.
limits
A list of cellranger::cell_limits object, as returned by split_sheet_find.
as
Character, indicating what to return - "limits": a list of limits (the default), "groups" a matrix of the same dimensions as the worksheet indicating what group each cell is in, or "both": a list with elements "limits" and "groups".

Value

For split_sheet and split_sheet_apply, a list of worksheet views; each view corresponds to one region of the sheet and the order within the list is currently arbitrary (but may be ordered predictably in a future version). For split_sheet_find, a list of cellranger::cell_limits objects, each corresponding to a region of the sheet that represents a separate rectangular region (again, order is arbitrary for now)

Details

This function works by applying the "flood fill" algorithm to non-blank cells in the worksheet and then squaring off the result.

The split_sheet_find function does the actual classification, and split_sheet_apply applies worksheet_view to these to produce something that can be used (approximately) as if it was a separate sheet.