Skip to main content
bold() changes the font weight of a selection of cells in a flextable.

Function signature

bold(x, i = NULL, j = NULL, bold = TRUE, part = "body")

Parameters

x
flextable
required
A flextable object.
i
integer | formula | logical
Row selector. Accepts integer indices, a one-sided formula (e.g., ~ col > 5), or a logical vector. NULL selects all rows in the specified part.
j
integer | character | formula
Column selector. Accepts integer indices, column names, a formula, or a logical vector. NULL selects all columns.
bold
logical
default:"TRUE"
TRUE to apply bold, FALSE to remove it.
part
string
default:"body"
Which part of the table to target: "body", "header", "footer", or "all".

Return value

The modified flextable object.

Examples

Make the header row bold:
ft <- flextable(head(iris))
ft <- bold(ft, bold = TRUE, part = "header")
ft
Make a specific column bold using a formula row selector:
ft <- flextable(head(mtcars))
ft <- bold(ft, i = ~ cyl > 4, j = "cyl")
ft

See also