I want to use kable()
from the kableExtra
package in R to add a footnote marker using the footnote_marker_number()
function to a header item, specifically through the add_header_above()
function. In this specific case, the documentation specifies that the double_escape
argument is set to TRUE
. I have done this, but I cannot get the table to properly display the footnote marker. Here is a reproducible example of what I tried:
library(tidyverse)
library(kableExtra)
kw0 <- paste0("test",footnote_marker_number(1,double_escape = T))
mtcars %>%
kbl("html",escape=F,booktabs=T) %>%
add_header_above(header = c(" " = 6,
setNames(6,kw0))) %>%
footnote(number = c("test"))
I expect to see the correct display of the marker, instead, I see test<sup>1</sup>
in the table. I have looked at similar questions here on Stack Overflow (kableExtra: Dynamic add_header_above labeling) but this has not resolved the problem. Would appreciate any guidance on this.