split-across-down: Split a huxtable into multiple huxtables

split-across-downR Documentation

Split a huxtable into multiple huxtables

Description

These functions split a huxtable horizontally or vertically, and return the new sub-tables in a list.

Usage

split_across(ht, after, height, headers = TRUE)

split_down(ht, after, width, headers = TRUE)

Arguments

ht

A huxtable.

after

Rows/columns after which to split. See rowspecs for details. Note that tidyselect semantics are allowed in split_down() but not split_across().

height, width

Maximum height/width for the result.

headers

Logical. Take account of header rows/columns?

Details

Only one of after and width or height must be given. If width or height is given, the huxtable will be split by col_width() or row_height(), which must be numeric with no NA values.

If headers is TRUE, all previous headers will be added to each new table.

Value

A list of huxtables.

See Also

restack-across-down

Examples

ht <- as_hux(matrix(LETTERS[1:16], 4, 4))
ht <- set_all_borders(ht)
split_across(ht, after = 2)
split_down(ht, after = c(1, 3))

col_width(ht) <- c(0.15, 0.1, 0.25, 0.3)
split_down(ht, width = 0.3)

# split by column name:
split_down(jams, "Type")

# headers are repeated:
split_across(jams, 3)


huxtable documentation built on Dec. 28, 2022, 1:09 a.m.