At work I wanted to use kable to visualize a easy variable description dataframe in R for a pdf r-markdown document. This worked fine. So for example I did:
library(cars) library(kableExtra) kable(cars)
What went wrong?
At some point I wanted to introduce line breaks in the table, and saw some post over here where they mention I should use the options: format=”latex”, escape=FALSE in the kable function, so something like:
library(cars) library(kableExtra) kable(cars,format="latex", escape=FALSE)
It did not work, and I deleted the format and escape options. Then, compiling the same document as in the beginning, knitting the document did not work anymore. I got
Latex failed to compile see … for debugging help…
and, most importantly the (above)error
Use of x doesn’t match its definition
in the render output of r markdown. It created a .md file, but no .pdf was created when knitting to pdf, knitting to html worked fine. I think its probably good to mention here, that the latex distribution I used for all of this is tiny tex installed via R, so:
tinytex::install_tinytex()
I looked everything up, but did not find any error codes that were related. Some people mentioned the problem were unloaded latex packages, but since this worked at the start, this did not really make sense to me.
I then reinstalled RStudio, including all packages aswell as R itself. This did not change the behaviour, I still get the same error codes.
I was expecting the originally working pdf output to work again. So:
library(cars) library(kableExtra) kable(cars)
should produce a pdf file without errors.
Goldstern420 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.