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:

  1. disable scientific notation. can done options(). add chunk @ beginning of document:

    ```{r, echo=false} options(scipen = 99) ``` 
  2. print number in math environment $ (this preserve scientific notation):

    testing $`r x`$. 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -