I ran the following code in a R code chunk.
library(knitr)
library(kableExtra)
library(tidyverse)
long_dt <- rbind(mtcars, mtcars, mtcars)
kable(
long_dt,
format = "latex",
longtable = T,
booktabs = T,
caption = "Longtable"
) %>%
add_header_above(c(" ", "Group 1" = 5, "Group 2" = 6)) %>%
kable_styling(latex_options = c("repeat_header"),
repeat_header_continued = "\\textit{(Continued on Next Page...)}")
But it prints unnecessary lines as shown below. Is there a way to correct this?