Skip to contents

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.

Examples

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

mpg

cyl

disp

hp

drat

wt

qsec

vs

am

gear

carb

21.0

6

160

110

3.90

2.620

16.46

21.0

6

160

110

3.90

2.875

17.02

22.8

4

108

93

3.85

2.320

18.61

21.4

6

258

110

3.08

3.215

19.44

18.7

8

360

175

3.15

3.440

17.02

18.1

6

225

105

2.76

3.460

20.22