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 | |
Hao Zhu | 68d4fe9 | 2017-07-25 14:07:50 -0400 | [diff] [blame] | 8 | \listoftables |
| 9 | |
Hao Zhu | 971d89f | 2017-06-07 19:22:47 -0400 | [diff] [blame] | 10 | ```{r setup, include=FALSE} |
| 11 | knitr::opts_chunk$set(echo = TRUE) |
| 12 | ``` |
| 13 | |
| 14 | ```{r} |
| 15 | library(tidyverse) |
| 16 | library(knitr) |
| 17 | library(kableExtra) |
| 18 | |
| 19 | dt <- rbind(mtcars, mtcars) |
| 20 | |
Hao Zhu | 7d4a3e3 | 2017-06-08 21:29:13 -0400 | [diff] [blame] | 21 | # kable(dt, "latex", longtable = T, caption="test table") %>% |
| 22 | # add_header_above(c(" ", "a" = 6, "b" = 5)) %>% |
| 23 | # kable_styling(latex_options = "repeat_header") |
Hao Zhu | 971d89f | 2017-06-07 19:22:47 -0400 | [diff] [blame] | 24 | ``` |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 25 | |
| 26 | ```{r} |
Hao Zhu | 68d4fe9 | 2017-07-25 14:07:50 -0400 | [diff] [blame] | 27 | kable(dt, "latex", longtable = T, caption = "test", booktabs = T) %>% |
Hao Zhu | 7d4a3e3 | 2017-06-08 21:29:13 -0400 | [diff] [blame] | 28 | kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "(...)") |
Hao Zhu | fdec184 | 2017-06-08 17:06:04 -0400 | [diff] [blame] | 29 | ``` |
| 30 | |
| 31 | ```{r} |
Hao Zhu | 6f95ea4 | 2017-07-25 13:12:12 -0400 | [diff] [blame] | 32 | kable(dt, "latex", longtable = T, caption = "test", booktabs = T) %>% |
| 33 | kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "continue of table 2", repeat_header_method = "replace") |
| 34 | ``` |
| 35 | |
| 36 | ```{r} |
Hao Zhu | fdec184 | 2017-06-08 17:06:04 -0400 | [diff] [blame] | 37 | kable(dt, "latex", longtable = T, booktabs = T) %>% |
| 38 | add_header_above(c(" ", "a" = 6, "b" = 5)) %>% |
Hao Zhu | 00ba87c | 2017-08-01 12:42:58 -0400 | [diff] [blame] | 39 | kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "(cont.)") |
Hao Zhu | a31e97f | 2017-06-08 14:55:41 -0400 | [diff] [blame] | 40 | ``` |
Hao Zhu | 2ce42b9 | 2017-06-15 17:15:33 -0400 | [diff] [blame] | 41 | |
| 42 | ```{r} |
| 43 | df <- data.frame(replicate(13, sample(1000000:9000000, 60,replace=TRUE))) |
| 44 | df$Sum <- rowSums(df) |
| 45 | totals <- colSums(df) |
| 46 | df <- rbind(df, totals) |
| 47 | names(df) <- c("Jan 2014", "Feb 2014", "Mar 2014", "Apr 2014", "May 2014", "Jun 2014", "Jul 2014", |
| 48 | "Aug 2014", "Sep 2014", "Oct 2014", "Nov 2014", "Dec 2014", "Jan 2015", "Sum") |
| 49 | kable(df, "latex", longtable = T, booktabs = T) %>% |
| 50 | kable_styling(latex_options = c("repeat_header"), font_size = 7) %>% |
| 51 | landscape() |
| 52 | ``` |