blob: 31e9f82240bc18f616353c4c026e8d3cac7e90de [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
Hao Zhued845862017-08-03 09:24:08 -040019dt <- rbind(mtcars[1:30,], mtcars)
Hao Zhu971d89f2017-06-07 19:22:47 -040020
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 Zhu245931c2017-09-01 22:43:56 -040027kable(dt, "latex", longtable = T, caption = "test", booktabs = T, caption.short = "sss") %>%
Hao Zhu6c9714a2017-10-02 14:52:45 -040028 kable_styling(latex_options = c("striped", "repeat_header"),
29 repeat_header_text = "(...)", repeat_header_continued = T)
Hao Zhufdec1842017-06-08 17:06:04 -040030```
31
32```{r}
Hao Zhu6f95ea42017-07-25 13:12:12 -040033kable(dt, "latex", longtable = T, caption = "test", booktabs = T) %>%
34 kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "continue of table 2", repeat_header_method = "replace")
35```
36
37```{r}
Hao Zhufdec1842017-06-08 17:06:04 -040038kable(dt, "latex", longtable = T, booktabs = T) %>%
39 add_header_above(c(" ", "a" = 6, "b" = 5)) %>%
Hao Zhu00ba87c2017-08-01 12:42:58 -040040 kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "(cont.)")
Hao Zhua31e97f2017-06-08 14:55:41 -040041```
Hao Zhu2ce42b92017-06-15 17:15:33 -040042
43```{r}
44df <- data.frame(replicate(13, sample(1000000:9000000, 60,replace=TRUE)))
45df$Sum <- rowSums(df)
46totals <- colSums(df)
47df <- rbind(df, totals)
48names(df) <- c("Jan 2014", "Feb 2014", "Mar 2014", "Apr 2014", "May 2014", "Jun 2014", "Jul 2014",
49 "Aug 2014", "Sep 2014", "Oct 2014", "Nov 2014", "Dec 2014", "Jan 2015", "Sum")
50kable(df, "latex", longtable = T, booktabs = T) %>%
51 kable_styling(latex_options = c("repeat_header"), font_size = 7) %>%
52 landscape()
53```