Merge repeated rows into multirow cells

merge_repeated_rows(ht, row, col)

Arguments

ht

A huxtable.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

Value

The ht object.

Details

Repeated rows in each column are merged into cells with rowspan > 1.

If row contains gaps, results may be unexpected (and a warning is given).

See also

Other cell merging: merge_across(), merge_cells()

Examples

ht <- as_hux(jams[c(1, 2, 2, 3, 3, 4), ]) ht <- add_columns(ht, c("Sugar", "30%", "40%", "30%", "40%", "30%"), after = 1) ht
#> Type Sugar Price #> Strawberry 30% 1.90 #> 40% #> Raspberry 30% 2.10 #> 40% #> Plum 30% 1.80 #> #> Column names: Type, , Price
merge_repeated_rows(ht)
#> Type Sugar Price #> Strawberry 30% 1.90 #> 40% #> Raspberry 30% 2.10 #> 40% #> Plum 30% 1.80 #> #> Column names: Type, , Price
merge_repeated_rows(ht, everywhere, "Type")
#> Type Sugar Price #> Strawberry 30% 1.90 #> 40% #> Raspberry 30% 2.10 #> 40% #> Plum 30% 1.80 #> #> Column names: Type, , Price