kableExtra : add a footnote to a rowname [kableExtra, Rmd]

Viewed 133

I'm using the kableExtra library with R Markdown, I would like to add footnotes to the row labels (and secondary, to other cells). How can I do that ?

Data example below:

library(kableExtra)
tab = data.frame(matrix(NA, 5,5))
rownames(tab) = paste("info", 1:5)
kable(tab)

I want to add a footnote to info 1, the label of the 1st line (for example).

Any ideas?

Thanks in advance

1 Answers

You can use footnotefrom kableExtra:

dt <- mtcars[1:5, 1:5]
footnote(knitr::kable(dt, "html"), alphabet = c("Note a", "Note b"))
Related