Skip to main content
footnote() attaches footnotes to selected cells. It adds a reference symbol to each targeted cell and appends the corresponding note text as a new row in the footer.

Function signature

footnote(
  x,
  i = NULL,
  j = NULL,
  value,
  ref_symbols = NULL,
  part = "body",
  inline = FALSE,
  sep = "; ",
  symbol_sep = ""
)

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.
j
integer | character | formula
Column selector. Accepts integer indices, column names, a formula, or a logical vector.
value
paragraph
required
A call to as_paragraph(). Each element of the paragraph corresponds to a cell targeted by the i/j selectors.
ref_symbols
character
Symbols to append to the selected cells as reference markers (e.g., c("a", "b", "c") or c("*", "**")). When a single symbol is provided, it is reused across all targeted cells.
part
string
default:"body"
Which part of the table contains the target cells: "body", "header", or "footer". The value "all" is not allowed.
inline
logical
default:"FALSE"
If TRUE, append the new footnote on the same footer row as the preceding footnote rather than creating a new row.
sep
string
default:"; "
Separator used between footnotes when inline = TRUE.
symbol_sep
string
default:""
Separator inserted between multiple footnote symbols in the same cell. For example, "," produces 1,2 instead of 12.

Return value

The modified flextable object.

Examples

Add three footnotes to the header row:
ft <- flextable(head(iris))
ft <- footnote(
  ft,
  i = 1, j = 1:3,
  value = as_paragraph(c(
    "This is footnote one",
    "This is footnote two",
    "This is footnote three"
  )),
  ref_symbols = c("a", "b", "c"),
  part = "header"
)
ft <- valign(ft, valign = "bottom", part = "header")
ft <- autofit(ft)
ft
Add two footnotes inline (on the same footer row):
ft <- flextable(head(iris))
ft <- autofit(ft)
ft <- footnote(
  ft,
  i = 1, j = 1:2,
  value = as_paragraph(c("Footnote one", "Footnote two")),
  ref_symbols = c("a", "b"),
  part = "header",
  inline = TRUE
)
ft <- footnote(
  ft,
  i = 1, j = 3:4,
  value = as_paragraph(c("Footnote three", "Footnote four")),
  ref_symbols = c("c", "d"),
  part = "header",
  inline = TRUE
)
ft
Repeat a single symbol across multiple cells:
ft <- flextable(head(iris))
ft <- autofit(ft)
ft <- footnote(
  x = ft,
  i = 1:3, j = 1:3,
  ref_symbols = "a",
  value = as_paragraph("This is footnote one")
)
ft

See also