Quick reference
| Function | What it does |
|---|---|
merge_h(x, i, part) | Merge identical adjacent cells horizontally |
merge_v(x, j, part) | Merge identical adjacent cells vertically |
merge_at(x, i, j, part) | Merge a specific rectangular range |
merge_h_range(x, i, j1, j2, part) | Merge a column range for selected rows |
merge_none(x) | Remove all merges |
"all" is not a valid value for part in merge functions.merge_h()
Merges consecutive cells in the same row that have identical formatted values.
A
flextable object.Row selector.
NULL processes all rows.Which part to process:
"body", "header", or "footer".Example
merge_v()
Merges consecutive cells in the same column that have identical formatted values.
A
flextable object.Column selector that controls which columns are inspected for consecutive identical values.
Column names where the merge should actually be applied. Useful when you want to trigger a merge based on one column’s values but apply it to additional columns. If
NULL, defaults to the columns selected by j.Which part to process:
"body", "header", or "footer".If
TRUE, the columns in j are combined into a single composite key before checking for consecutive identical values. If FALSE, each column is inspected independently.Example
Merge vertically on two columns:merge_at()
Merges all cells in a specified rectangular range into a single cell. All selected rows and columns must be consecutive.
A
flextable object.Row selector.
Column selector.
Which part to process:
"body", "header", or "footer".Example
merge_h_range()
Merges a consecutive range of columns into a single cell for each selected row. Both j1 and j2 must define consecutive columns.
A
flextable object.Row selector.
The first (leftmost) column of the merge range.
The last (rightmost) column of the merge range.
Which part to process:
"body", "header", or "footer".Example
merge_none()
Removes all cell merging information from a flextable, restoring each cell to independent display.
A
flextable object.