blob: 3ecc58b34cc2e1c21a3db03212218615646038c5 [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 Zhu876bcb02020-08-12 23:02:51 -040016kable(bind_rows(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 Zhu876bcb02020-08-12 23:02:51 -040018 collapse_rows(1:2, latex_hline = "linespace")
Hao Zhuf4b35292017-06-25 22:38:37 -100019```