blob: 404f8c5830f0af7edfea873846e37f80adb70626 [file] [log] [blame]
Hao Zhu4f8eaa22018-01-11 16:14:25 -05001---
2title: "Legacy or Unrecommended Features"
3author: "Hao Zhu"
4date: "`r Sys.Date()`"
5output:
6 html_document:
7 theme: simplex
8vignette: >
9 %\VignetteIndexEntry{Legacy or Unrecommended Features}
10 %\VignetteEngine{knitr::rmarkdown}
11 %\VignetteEncoding{UTF-8}
12---
13
14This document includes documentations for legacy/unrecommended features in this package.
15
16Unless there are significant differences between HTML/LaTeX, I will only keep one copy of documentation in HTML here since most of the functions in this packages share a very similar interface between their HTML and LaTeX ends.
17
18```{r, warning=FALSE}
Hao Zhu4f8eaa22018-01-11 16:14:25 -050019library(kableExtra)
20dt <- mtcars[1:5, 1:6]
21```
22
23# Unrecommended Features
24
25## add_footnote
26As the first function written in this package, the design of the `add_footnote` function is not flexible enough to introduce new features to this function. So I redesigned the footnote part and created the `footnote()` function. `add_footnote` will still be there for a while and be maintained because of its unique feature to add page footnote to longtables.
27
28Here are the old documentation for `add_footnote`.
29
30### Notation systems
31You can also use `add_footnote()` function from this package. You will need to supply a character vector with each element as one footnote. You may select from `number`, `alphabet` and `symbol` for different types of notations. Example are listed below.
32
33#### Alphabet
34```{r}
35kable(dt, "html") %>%
36 kable_styling("striped") %>%
37 add_footnote(c("Footnote 1", "Have a good day."), notation = "alphabet")
38```
39
40#### Number
41```{r}
42kable(dt, "html") %>%
43 kable_styling("striped") %>%
44 add_footnote(c("Footnote 1", "Have a good day."), notation = "number")
45```
46
47#### Symbol
48```{r}
49kable(dt, "html") %>%
50 kable_styling("striped") %>%
51 add_footnote(c("Footnote 1", "Footnote 2", "Footnote 3"), notation = "symbol")
52```
53
54### In-table markers
55By design, `add_footnote()` will transform any `[note]` to in-table footnote markers.
56
57```{r}
58kable(dt, "html", caption = "Demo Table[note]") %>%
59 kable_styling("striped") %>%
60 add_header_above(c(" ", "Group 1[note]" = 3, "Group 2[note]" = 3)) %>%
61 add_footnote(c("This table is from mtcars",
62 "Group 1 contains mpg, cyl and disp",
63 "Group 2 contains hp, drat and wt"),
64 notation = "symbol")
65```