blob: a95c9f69c90332b6db22f40ec1938e0b9ef20d36 [file] [log] [blame]
Hao Zhuf4b35292017-06-25 22:38:37 -10001---
2title: "Untitled"
Hao Zhu654c91f2017-07-03 14:03:34 -04003output:
4 pdf_document:
5 keep_tex: true
Hao Zhuf4b35292017-06-25 22:38:37 -10006---
7
8```{r}
9library(knitr)
Hao Zhu71b30f22020-08-12 22:47:13 -040010library(dplyr)
Hao Zhuf4b35292017-06-25 22:38:37 -100011library(kableExtra)
12collapse_rows_dt <- data.frame(C1 = c(rep("aaaaaa aaaaaa", 10), rep("bbbbb bbbbbb", 5)),
Hao Zhu71b30f22020-08-12 22:47:13 -040013 C2 = c(rep("c", 7), rep("d", 3), rep("c", 3), rep("d", 2)),
Hao Zhuf4b35292017-06-25 22:38:37 -100014 C3 = 1:15,
15 C4 = sample(c(0,1), 15, replace = TRUE))
Hao Zhu71b30f22020-08-12 22:47:13 -040016kable(bind_rows(collapse_rows_dt, collapse_rows_dt, collapse_rows_dt, collapse_rows_dt), "latex", align = "c", booktabs = T, longtable= T) %>%
Hao Zhu654c91f2017-07-03 14:03:34 -040017 column_spec(1, bold = T, width = "5em") %>%
Hao Zhu71b30f22020-08-12 22:47:13 -040018 collapse_rows(1:2, latex_hline = "full", longtable_clean_cut = T) %>%
19 cat()
Hao Zhuf4b35292017-06-25 22:38:37 -100020```