library(tibble)
library (kableExtra)
library(huxtable)
##
## Attaching package: 'huxtable'
## The following object is masked from 'package:kableExtra':
##
## add_footnote
Person <- c("A", "A", "B", "B", "C", "C")
Group <- c("pre", "post", "pre", "post", "pre", "post")
Value <- c("10", "5", "8", "4", "5", "4")
df <- tibble(Person, Group, Value)
kbl(df, booktabs = TRUE) |>
collapse_rows(valign = "top",
latex_hline = "major")
|
Person
|
Group
|
Value
|
|
A
|
pre
|
10
|
|
A
|
post
|
5
|
|
B
|
pre
|
8
|
|
B
|
post
|
4
|
|
C
|
pre
|
5
|
|
C
|
post
|
4
|
df
| Person | Group | Value |
| A | pre | 10 |
| A | post | 5 |
| B | pre | 8 |
| B | post | 4 |
| C | pre | 5 |
| C | post | 4 |
df <- df %>% hux() %>%
merge_repeated_rows()%>%
set_bottom_border(, row = odds, col = everywhere)
df
| Person | Group | Value |
| A | pre | 10 |
| post | 5 |
| B | pre | 8 |
| post | 4 |
| C | pre | 5 |
| post | 4 |
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.