I'm writing a pdf report in RMarkdown and want to float_left a kable with a caption. This works without a caption:
---
title: "test2"
output: pdf_document
header-includes:
- \usepackage{wrapfig}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
options(knitr.table.format="latex")
```{r, echo=FALSE}
library(knitr)
library(kableExtra)
kbl(head(cars), booktabs=T) %>%
kable_styling(latex_options = "striped", position = "float_left")
But adding caption="A Caption" to the kbl line, as in
kbl(head(cars), caption="A Caption", booktabs=T) %>%
throws this error:
! Extra }, or forgotten \endgroup.
\endwraptable ...kip \egroup \box \z@ \fi \egroup
\WF@floatstyhook \def \wid...
l.164 \end{wraptable}
Error: LaTeX failed to compile test2.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test2.log for more info.
Execution halted
I've searched SO for what I'd think would be a frequent situation, but have found nothing. It must be something simple I'm missing. Help please.
