void: Clear the displayed content of selected columns

View source: R/empty.R

voidR Documentation

Clear the displayed content of selected columns

Description

void() replaces the visible text of the selected columns with an empty string. The columns themselves (and their headers) remain in the table, but the cell values are no longer displayed.

This is useful when a column should stay in the layout (e.g. to preserve its width or to keep its header label) but its body values should be hidden, for instance after using compose() to build a richer display in a neighbouring column that already incorporates those values.

The underlying dataset is not modified; only the displayed content is affected. To remove a column entirely, use the col_keys argument of flextable() instead.

Usage

void(x, j = NULL, part = "body")

Arguments

x

a 'flextable' object, see flextable-package to learn how to create 'flextable' object.

j

column selector, see section Column selection with the j parameter in <Selectors in flextable>.

part

part selector, see section Part selection with the part parameter in <Selectors in flextable>. Value 'all' can be used.

See Also

Other functions to compose cell content: append_chunks(), as_paragraph(), compose(), footnote(), labelizor(), prepend_chunks()

Examples

ftab <- flextable(head(mtcars))
ftab <- void(ftab, ~ vs + am + gear + carb)
ftab

flextable documentation built on June 2, 2026, 9:08 a.m.