rr-flextable

is it possible to hide the footnote number reference in flextable footer section and replace with own text


I have a flextable:

df = data.frame(col1 = c(123,234,54,5), col2 = c(NA,1,2,3), col3 = 5:8)
df %>%
  flextable() %>%
  footnote(i = 1, j = 1,
           value = as_paragraph('this is a footnote'),
           ref_symbols = "1",
           part = "body") %>%
  footnote(i = 1, j = 1,
           value = as_paragraph(as_b("Note (2):"),"This is another foonote"),
           ref_symbols = "2",
           part = "body") 

that shows

enter image description here

What I would like to do is keep the flextable and footnotes, but remove the little 1 and 2 that appear in the footer section.


Solution

  • You can use add_footer_lines() to add any content in a new line and append_chunks() to append any content in existing cells/rows/columns (prepend_chunks() can sometimes be useful)

    library(flextable)
    df <- data.frame(col1 = c(123,234,54,5), col2 = c(NA,1,2,3), col3 = 5:8)
    df |>
      flextable() |>
      add_footer_lines("Here is a foonote") |> 
      add_footer_lines(as_paragraph(as_b("Note (2):"),"This is another foonote")) |> 
      append_chunks(i = 1, j = 1, as_sup("12")) |> 
      append_chunks(i = 2, j = 1, as_sup("‡"))
    

    enter image description here