Rmarkdown:pandoc 文档转换失败,错误 43,因为数字太大
Rmarkdown: pandoc document conversion failed with error 43 because of large number
我 运行 在通过 Rmarkdown 在 Rstudio 中编织 pdf 时遇到问题。我想这源于代码块之外引用的 r 变量的值的数字太多。
---
title: "R Notebook"
output:
pdf_document: default
html_notebook: default
---
```{r}
x <- 11111111111111
```
Testing for `r x`.
错误是
! Missing $ inserted.
<inserted text>
$
l.133 Testing for 1.1111111\times
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted
希望有人能帮帮我。
这是因为长数字在打印时被转换为科学记数法(如 1.1e11),并且因为这种科学记数法使用了乳胶数学符号 \times
。有两种解决方法:
禁用科学记数法。这可以用 options()
来完成。在文档的开头添加此块:
```{r, echo=FALSE}
options(scipen = 99)
```
使用 $
在数学环境中打印您的数字(这将保留科学记数法):
Testing for $`r x`$.
我 运行 在通过 Rmarkdown 在 Rstudio 中编织 pdf 时遇到问题。我想这源于代码块之外引用的 r 变量的值的数字太多。
---
title: "R Notebook"
output:
pdf_document: default
html_notebook: default
---
```{r}
x <- 11111111111111
```
Testing for `r x`.
错误是
! Missing $ inserted.
<inserted text>
$
l.133 Testing for 1.1111111\times
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted
希望有人能帮帮我。
这是因为长数字在打印时被转换为科学记数法(如 1.1e11),并且因为这种科学记数法使用了乳胶数学符号 \times
。有两种解决方法:
禁用科学记数法。这可以用
options()
来完成。在文档的开头添加此块:```{r, echo=FALSE} options(scipen = 99) ```
使用
$
在数学环境中打印您的数字(这将保留科学记数法):Testing for $`r x`$.