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