blob: fef0f3b8a5506817d64602728ac8ababbb3ff9ef [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
8```{r setup, include=FALSE}
9knitr::opts_chunk$set(echo = TRUE)
10```
11
12```{r}
13library(tidyverse)
14library(knitr)
15library(kableExtra)
16
17dt <- rbind(mtcars, mtcars)
18
Hao Zhu7d4a3e32017-06-08 21:29:13 -040019# kable(dt, "latex", longtable = T, caption="test table") %>%
20# add_header_above(c(" ", "a" = 6, "b" = 5)) %>%
21# kable_styling(latex_options = "repeat_header")
Hao Zhu971d89f2017-06-07 19:22:47 -040022```
Hao Zhua31e97f2017-06-08 14:55:41 -040023
24```{r}
Hao Zhu6f95ea42017-07-25 13:12:12 -040025kable_input <- kable(dt, "latex", longtable = T, caption = "test", booktabs = T) %>%
Hao Zhu7d4a3e32017-06-08 21:29:13 -040026 kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "(...)")
Hao Zhufdec1842017-06-08 17:06:04 -040027```
28
29```{r}
Hao Zhu6f95ea42017-07-25 13:12:12 -040030kable(dt, "latex", longtable = T, caption = "test", booktabs = T) %>%
31 kable_styling(latex_options = c("striped", "repeat_header"), repeat_header_text = "continue of table 2", repeat_header_method = "replace")
32```
33
34```{r}
Hao Zhufdec1842017-06-08 17:06:04 -040035kable(dt, "latex", longtable = T, booktabs = T) %>%
36 add_header_above(c(" ", "a" = 6, "b" = 5)) %>%
37 kable_styling(latex_options = "repeat_header", repeat_header_text = "(cont.)")
Hao Zhua31e97f2017-06-08 14:55:41 -040038```
Hao Zhu2ce42b92017-06-15 17:15:33 -040039
40```{r}
41df <- data.frame(replicate(13, sample(1000000:9000000, 60,replace=TRUE)))
42df$Sum <- rowSums(df)
43totals <- colSums(df)
44df <- rbind(df, totals)
45names(df) <- c("Jan 2014", "Feb 2014", "Mar 2014", "Apr 2014", "May 2014", "Jun 2014", "Jul 2014",
46 "Aug 2014", "Sep 2014", "Oct 2014", "Nov 2014", "Dec 2014", "Jan 2015", "Sum")
47kable(df, "latex", longtable = T, booktabs = T) %>%
48 kable_styling(latex_options = c("repeat_header"), font_size = 7) %>%
49 landscape()
50```