rstudio - Rmarkdown: pandoc document conversion failed with error 43 because of large number -
i ran problems while knit pdf in rstudio via rmarkdown. suppose stems many digits value of quoted r variable outside chunk of code.
--- title: "r notebook" output: pdf_document: default html_notebook: default --- ```{r} x <- 11111111111111 ``` testing `r x`.
error
! missing $ inserted. <inserted text> $ l.133 testing 1.1111111\times pandoc: error producing pdf error: pandoc document conversion failed error 43 execution halted
hope can me out here.
this happens because long numbers transformed scientific notation (like 1.1e11) when printed, , because scientific notation makes use of latex math symbol \times
. there 2 workarounds:
disable scientific notation. can done
options()
. add chunk @ beginning of document:```{r, echo=false} options(scipen = 99) ```
print number in math environment
$
(this preserve scientific notation):testing $`r x`$.
Comments
Post a Comment