Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add notes to the bottom of a table using knitr::kable?

LaTeX has the ability to add notes to the bottom of a table using tablenotes, so it seems like kable might be able to easily implement this -- or maybe it already does, but I can't find any mention of this capability.

For example: Table notes at the bottom of a table

like image 454
jflournoy Avatar asked Jan 13 '15 22:01

jflournoy


1 Answers

You can actually do exactly this using Hao Zhu's awesome kableExtra package! As follows:

library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:4]

# LaTeX Table
 kable(dt, format = "latex", booktabs = T) %>%
   kable_styling() %>%
   add_footnote("Footnote 1", notation="alphabet")

enter image description here

Check out the GitHub repository for the full scope of everything kableExtra can do. It greatly extends the functionality of tables within both LaTeX and HTML with loads of extra features.

like image 189
Grace Mahoney Avatar answered Oct 07 '22 23:10

Grace Mahoney