Hao Zhu | 4f8eaa2 | 2018-01-11 16:14:25 -0500 | [diff] [blame^] | 1 | --- |
| 2 | title: "Legacy or Unrecommended Features" |
| 3 | author: "Hao Zhu" |
| 4 | date: "`r Sys.Date()`" |
| 5 | output: |
| 6 | html_document: |
| 7 | theme: simplex |
| 8 | vignette: > |
| 9 | %\VignetteIndexEntry{Legacy or Unrecommended Features} |
| 10 | %\VignetteEngine{knitr::rmarkdown} |
| 11 | %\VignetteEncoding{UTF-8} |
| 12 | --- |
| 13 | |
| 14 | This document includes documentations for legacy/unrecommended features in this package. |
| 15 | |
| 16 | Unless 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} |
| 19 | library(knitr) |
| 20 | library(kableExtra) |
| 21 | dt <- mtcars[1:5, 1:6] |
| 22 | ``` |
| 23 | |
| 24 | # Unrecommended Features |
| 25 | |
| 26 | ## add_footnote |
| 27 | As 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. |
| 28 | |
| 29 | Here are the old documentation for `add_footnote`. |
| 30 | |
| 31 | ### Notation systems |
| 32 | You 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. |
| 33 | |
| 34 | #### Alphabet |
| 35 | ```{r} |
| 36 | kable(dt, "html") %>% |
| 37 | kable_styling("striped") %>% |
| 38 | add_footnote(c("Footnote 1", "Have a good day."), notation = "alphabet") |
| 39 | ``` |
| 40 | |
| 41 | #### Number |
| 42 | ```{r} |
| 43 | kable(dt, "html") %>% |
| 44 | kable_styling("striped") %>% |
| 45 | add_footnote(c("Footnote 1", "Have a good day."), notation = "number") |
| 46 | ``` |
| 47 | |
| 48 | #### Symbol |
| 49 | ```{r} |
| 50 | kable(dt, "html") %>% |
| 51 | kable_styling("striped") %>% |
| 52 | add_footnote(c("Footnote 1", "Footnote 2", "Footnote 3"), notation = "symbol") |
| 53 | ``` |
| 54 | |
| 55 | ### In-table markers |
| 56 | By design, `add_footnote()` will transform any `[note]` to in-table footnote markers. |
| 57 | |
| 58 | ```{r} |
| 59 | kable(dt, "html", caption = "Demo Table[note]") %>% |
| 60 | kable_styling("striped") %>% |
| 61 | add_header_above(c(" ", "Group 1[note]" = 3, "Group 2[note]" = 3)) %>% |
| 62 | add_footnote(c("This table is from mtcars", |
| 63 | "Group 1 contains mpg, cyl and disp", |
| 64 | "Group 2 contains hp, drat and wt"), |
| 65 | notation = "symbol") |
| 66 | ``` |