The developers of kableExtra were able to resolve this issue. Details found here. add_header_above
must be placed prior to kable_styling
---
title: "Test"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(knitr)
library(kableExtra)
```
Some text to anchor the first table.
```{r test-table}
tibble(col1 = rep("Random text", 80),
n1 = 1:80,
perc1 = 1:80,
n2 = 1:80,
perc2 = 1:80) %>%
kbl(col.names = c("Category", "n", "\\%", "n", "\\%"),
caption = "Reproducible caption",
longtable = TRUE, escape = FALSE, booktabs = TRUE, linesep = "") %>%
add_header_above(c(" " = 1,
"Group 1" = 2,
"Group 2" = 2)) %>%
kable_styling(latex_options = c("HOLD_position", "repeat_header"),
position = "left")
```