Hao Zhu | 971d89f | 2017-06-07 19:22:47 -0400 | [diff] [blame] | 1 | --- |
| 2 | title: "Untitled" |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 3 | output: |
| 4 | pdf_document: |
| 5 | keep_tex: true |
Hao Zhu | 971d89f | 2017-06-07 19:22:47 -0400 | [diff] [blame] | 6 | --- |
| 7 | |
| 8 | ```{r setup, include=FALSE} |
| 9 | knitr::opts_chunk$set(echo = TRUE) |
| 10 | ``` |
| 11 | |
| 12 | ```{r} |
| 13 | library(tidyverse) |
| 14 | library(knitr) |
| 15 | library(kableExtra) |
| 16 | |
| 17 | dt <- rbind(mtcars, mtcars) |
| 18 | |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 19 | kable(dt, "latex", longtable = T, caption="test table") %>% |
Hao Zhu | 971d89f | 2017-06-07 19:22:47 -0400 | [diff] [blame] | 20 | add_header_above(c(" ", "a" = 6, "b" = 5)) %>% |
| 21 | kable_styling(latex_options = "repeat_header") |
| 22 | ``` |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 23 | |
| 24 | ```{r} |
Hao Zhu | fdec184 | 2017-06-08 17:06:04 -0400 | [diff] [blame^] | 25 | aaa <- kable(dt, "latex", longtable = T, caption="table2", booktabs = T) %>% |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 26 | add_header_above(c(" ", "a" = 6, "b" = 5)) %>% |
Hao Zhu | fdec184 | 2017-06-08 17:06:04 -0400 | [diff] [blame^] | 27 | kable_styling(latex_options = "repeat_header", repeat_header_text = "(...)") |
| 28 | ``` |
| 29 | |
| 30 | ```{r} |
| 31 | kable(dt, "latex", longtable = T, booktabs = T) %>% |
| 32 | add_header_above(c(" ", "a" = 6, "b" = 5)) %>% |
| 33 | kable_styling(latex_options = "repeat_header", repeat_header_text = "(cont.)") |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 34 | ``` |