blob: 47b1f50b27fe327e085c23b46d564b3cbf788713 [file] [log] [blame]
Hao Zhu971d89f2017-06-07 19:22:47 -04001---
2title: "Untitled"
Hao Zhua31e97f2017-06-08 14:55:41 -04003output:
4 pdf_document:
5 keep_tex: true
Hao Zhu971d89f2017-06-07 19:22:47 -04006---
7
Hao Zhu68d4fe92017-07-25 14:07:50 -04008\listoftables
9
Hao Zhu971d89f2017-06-07 19:22:47 -040010```{r setup, include=FALSE}
11knitr::opts_chunk$set(echo = TRUE)
12```
13
14```{r}
15library(tidyverse)
16library(knitr)
17library(kableExtra)
18
19dt <- rbind(mtcars, mtcars)
20
Hao Zhu7d4a3e32017-06-08 21:29:13 -040021# 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 Zhu971d89f2017-06-07 19:22:47 -040024```
Hao Zhua31e97f2017-06-08 14:55:41 -040025
26```{r}
Hao Zhu68d4fe92017-07-25 14:07:50 -040027kable(dt, "latex", longtable = T, caption = "test", booktabs = T) %>%
Hao Zhu7d4a3e32017-06-08 21:29:13 -040028 kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "(...)")
Hao Zhufdec1842017-06-08 17:06:04 -040029```
30
31```{r}
Hao Zhu6f95ea42017-07-25 13:12:12 -040032kable(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 Zhufdec1842017-06-08 17:06:04 -040037kable(dt, "latex", longtable = T, booktabs = T) %>%
38 add_header_above(c(" ", "a" = 6, "b" = 5)) %>%
39 kable_styling(latex_options = "repeat_header", repeat_header_text = "(cont.)")
Hao Zhua31e97f2017-06-08 14:55:41 -040040```
Hao Zhu2ce42b92017-06-15 17:15:33 -040041
42```{r}
43df <- data.frame(replicate(13, sample(1000000:9000000, 60,replace=TRUE)))
44df$Sum <- rowSums(df)
45totals <- colSums(df)
46df <- rbind(df, totals)
47names(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")
49kable(df, "latex", longtable = T, booktabs = T) %>%
50 kable_styling(latex_options = c("repeat_header"), font_size = 7) %>%
51 landscape()
52```