Rmarkdown-运行代码并在文档中显示错误 [英] Rmarkdown - Run code and display errors in document
问题描述
运行下面的代码时,我得到一条错误消息,这是我期望的-我希望将其运行并显示在pdf中,但是错误在r中返回,并且代码未运行.
I get an error message when running the code below which is expected - I would like this to be ran and displayed in the pdf, however the error is returned in r and the code doesn't run.
{r, warning=TRUE}
library(survey)
debug(withReplicates.svyrep.design)
{r, warning=TRUE}
library(survey)
debug(withReplicates.svyrep.design)
我已经尝试过warning=TRUE
,但这是行不通的.
I have tried warning=TRUE
but this doesn't work.
如何获取文档中显示的错误?
How can I get the error displayed in the document?
推荐答案
在块选项中添加error=TRUE
.这将导致脚本运行完成,并在输出中出现错误.
Add error=TRUE
to the chunk options. That will result in the script running to completion with the error appearing in the output.
这篇关于Rmarkdown-运行代码并在文档中显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!