I ran into problems while knit the pdf in Rstudio via Rmarkdown. I suppose it stems from too many digits for the value of quoted r variable outside the chunk of code.
<
This happens because long numbers are transformed to scientific notation (like 1.1e11) when printed, and because this scientific notation makes use of latex math symbol \times
. There are two workarounds:
Disable scientific notation. This can be done with options()
. Add this chunk at the beginning of the document:
```{r, echo=FALSE}
options(scipen = 99)
```
Print your number in a math environment with $
(this will preserve scientific notation):
Testing for $`r x`$.