Hao Zhu | f4b3529 | 2017-06-25 22:38:37 -1000 | [diff] [blame] | 1 | --- |
| 2 | title: "Untitled" |
Hao Zhu | 654c91f | 2017-07-03 14:03:34 -0400 | [diff] [blame^] | 3 | output: |
| 4 | pdf_document: |
| 5 | keep_tex: true |
Hao Zhu | f4b3529 | 2017-06-25 22:38:37 -1000 | [diff] [blame] | 6 | --- |
| 7 | |
| 8 | ```{r} |
| 9 | library(knitr) |
| 10 | library(kableExtra) |
| 11 | collapse_rows_dt <- data.frame(C1 = c(rep("aaaaaa aaaaaa", 10), rep("bbbbb bbbbbb", 5)), |
Hao Zhu | 654c91f | 2017-07-03 14:03:34 -0400 | [diff] [blame^] | 12 | C2 = c(rep("c", 7), rep("d", 4), rep("c", 2), rep("d", 2)), |
Hao Zhu | f4b3529 | 2017-06-25 22:38:37 -1000 | [diff] [blame] | 13 | C3 = 1:15, |
| 14 | C4 = sample(c(0,1), 15, replace = TRUE)) |
| 15 | kable(collapse_rows_dt, "latex", align = "c", booktabs = T) %>% |
Hao Zhu | 654c91f | 2017-07-03 14:03:34 -0400 | [diff] [blame^] | 16 | column_spec(1, bold = T, width = "5em") %>% |
| 17 | collapse_rows(1:2) |
Hao Zhu | f4b3529 | 2017-06-25 22:38:37 -1000 | [diff] [blame] | 18 | ``` |