--- | |
title: "Untitled" | |
output: | |
pdf_document: | |
keep_tex: true | |
--- | |
```{r} | |
library(knitr) | |
library(kableExtra) | |
collapse_rows_dt <- data.frame(C1 = c(rep("aaaaaa aaaaaa", 10), rep("bbbbb bbbbbb", 5)), | |
C2 = c(rep("c", 7), rep("d", 4), rep("c", 2), rep("d", 2)), | |
C3 = 1:15, | |
C4 = sample(c(0,1), 15, replace = TRUE)) | |
kable(collapse_rows_dt, "latex", align = "c") %>% | |
column_spec(1, bold = T, width = "5em") %>% | |
collapse_rows(1:2) | |
``` |