adjacent_blocks: Identify Adjacent Blocks of Table Cells

View source: R/adjacent_blocks.bare.R

adjacent_blocksR Documentation

Identify Adjacent Blocks of Table Cells

Description

For each block of table cells in a tblBlocks object, identify the other blocks that are adjacent to it on each side. This is an internal utility function, not intended to be called by package users.

Usage

adjacent_blocks(x)

Arguments

x

A tblBlocks object, defining a collection of rectangular blocks of cells in a table.

Details

A block B is considered adjacent to block A if (a) the blocks do not intersect (have no cells in common); and (b) the blocks touch along at least part of one edge (they span overlapping sets of rows in adjacent columns, or overlapping sets of columns in adjacent rows).

It requires storage and time proportional to the square of the number of blocks. For realistic tables this is not likely to be a problem.

Value

A list array with one row per block in x, and four columns. The rows are named by the block id, and the columns as "top", "right", "bottom", and "left". Element [[i, j]] is a character vector containing the ID's of all blocks that are adjacent to block i on side j. If there are no adjacent blocks, the element is character(0).

See Also

tblHvrules


tablesgg documentation built on June 22, 2024, 11:02 a.m.