I'm trying to do something quite simple: generate reports in PDF format. Finally found a way that reproduces my issue. I need to use rmarkdown::render
to create reports based on data in GlobalEnv
. I am using the tinytex
package. Here is test.Rmd
:
---
title: "Untitled"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(kableExtra)
library(tidyverse)
```
## R Markdown
```{r cars}
mtcars %>%
kable(booktabs = TRUE) %>%
kable_styling(latex_options = "striped")
```
Works:
"Knit" in RStudio seems to always work on this file, producing, as expected, the mtcars
dataframe, nicely formatted with kable()
Doesn't work (but should?):
Running rmarkdown::render("test.Rmd")
works on THE FIRST RUN, but NOT the second. It throws the error:
! LaTeX Error: Unknown float option `H'.
After this, "Knit" in RStudio produces the PDF, but R/knitr prints any warning/error messages from the rmarkdown::render("test.Rmd")
command.
Additional Information
Running rmarkdown::render("test.Rmd")
does not produce errors if the above code chunk is changed to
```{r cars}
mtcars %>%
kable()
```