output: pdf_document
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
PersonGroupValue
Apre10
Apost5
Bpre8
Bpost4
Cpre5
Cpost4
  df <- df %>% hux() %>%
   merge_repeated_rows()%>%
   set_bottom_border(, row = odds, col = everywhere)
  
df
PersonGroupValue
Apre10
post5
Bpre8
post4
Cpre5
post4

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.