blob: 6b2386720720b1b996681bb2cb1552830d1b7686 [file] [log] [blame]
Hao Zhue10cfd32017-02-21 16:41:14 -05001---
2title: add_footnote - HTML
3output: html_document
Hao Zhu94956582017-02-21 18:18:29 -05004vignette: >
5 %\VignetteIndexEntry{Use add_footnote in HTML document}
6 %\VignetteEngine{knitr::rmarkdown}
7 %\VignetteEncoding{UTF-8}
Hao Zhue10cfd32017-02-21 16:41:14 -05008---
9
10# Through Pandoc
11```{r through_pandoc}
12library(knitr)
13library(kableExtra)
14dt <- mtcars[1:5, 1:2]
15colnames(dt)[1] <- c("mpg[note]")
16rownames(dt)[2] <- c("Mazda RX4 Wag[note]")
17dt[3, 2] <- paste0(dt[3, 2], "[note]")
18
19kable(dt) %>%
20 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
21```
22
23# Through HTML
24## Plain HTML
25```{r through_html}
26kable(dt, format = "html") %>%
27 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
28```
29
30## HTML + bootstrap table
31```{r through_html_bootstrap}
32kable(dt, format = "html", table.attr = htmlTable_styling()) %>%
33 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
34```
35
36## HTML + bootstrap narrow table
37```{r through_latex_longtable}
38kable(dt, format = "html",
39 table.attr = htmlTable_styling(c("striped", "bordered"),
40 full_width = F)) %>%
41 add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
42```