渲染多个 Rmarkdown 报告时出现 Pandoc 错误 1033 [英] Pandoc error 1033 when rendering multiple Rmarkdown reports

查看:57
本文介绍了渲染多个 Rmarkdown 报告时出现 Pandoc 错误 1033的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含循环的 r 脚本,我在其中调用 rmarkdown::render() 来创建多个 HTML 报告.这个过程运行良好,直到我开始生成更大的报告文件(这让我想到了内存问题......).

经过几次成功迭代后,该过程停止并在 R 控制台中显示以下消息:错误:pandoc 文档转换失败,错误为 1033.

以下是 render() 函数在循环中的使用方式:

for (i in 1:length(random_vector)) {id = random_vector[i]knitr::knit_meta(class=NULL, clean = TRUE) # 不能阻止问题rmarkdown::render("my_rmd_file_that_generates_reports.Rmd",output_file = paste(id_fiche, "report.html"))}

此处未提及此错误:https://pandoc.org/help.html 并且确实与此不对应:https://github.com/jgm/pandoc/issues/1033.这里提到的想法 rmarkdown::render() 在循环中 -无法使用此行分配大小的向量:knitr::knit_meta(class=NULL, clean = TRUE) 没有解决这个问题.

注意:我无法给出一个可重复的例子,因为我不知道问题的确切根源,我希望有人遇到同样的问题并找到解决方法.

会话信息:

R 版本 3.6.0 (2019-04-26)

平台:x86_64-w64-mingw32/x64(64位)

运行环境:Windows 10 x64 (build 18362)

这是我正在使用的 pandoc 版本:

>pandoc_version()[1] ‘2.6’

解决方案

这里是解决错误的过程.这个想法来自 @tarleb 的 评论.错误 1033 不是 Pandoc 错误;这里没有引用:https://github.com/jgm/pandoc/blob/master/MANUAL.txt#L1384.

而且不是knitr::knit_meta(class=NULL, clean = TRUE)可以解决的内存使用问题

按照此处的建议,更新 Pandoc 可以解决方案.

  1. 使用 rmarkdown::pandoc_version() 检查当前用于生成 Rmarkdown 报告的 pandoc 版本.
  2. 访问此网站:https://pandoc.org/releases.html 并检查是否您使用的版本是最新的.

对我来说不是这样(我使用的是 Pandoc 的 v2.6,最后一个是 v2.7.3)所以我遵循了这个页面的教程:https://pandoc.org/installing.html.>

然后我检查了 rmarkdown::pandoc_version() 是否返回了最新版本号,然后我重新运行了我的 R 脚本.它解决了问题.

I have r script containing a loop in which I call rmarkdown::render() to create multiple HTML reports.The process worked well until I started to generate larger report files (which make me think about a memory problem...).

After a few successful iteration, the process stops with this message in the R console: Error: pandoc document conversion failed with error 1033.

Here is how the render() function is used inside the loop :

for (i in 1:length(random_vector)) {
  id = random_vector[i]

  knitr::knit_meta(class=NULL, clean = TRUE) # does not prevent the problem

  rmarkdown::render("my_rmd_file_that_generates_reports.Rmd", 
                    output_file = paste(id_fiche, "report.html"))

}

This error is not mentioned here : https://pandoc.org/help.html and does not correspond to this one : https://github.com/jgm/pandoc/issues/1033. The idea mentionned here rmarkdown::render() in a loop - cannot allocate vector of size using this line:knitr::knit_meta(class=NULL, clean = TRUE) is not solving this problem.

NOTE: I can not give a reproductible exemple as I do not know the precise origin of the problem, I hope someone faced the same problem and found a way to takle it.

Session info :

R version 3.6.0 (2019-04-26)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 18362)

[EDIT] Here is the pandoc version I am using :

>pandoc_version()
[1] ‘2.6’

解决方案

Here is the process that solved the error. The idea comes from @tarleb's comment. Error 1033 is not a Pandoc error ; it is not referenced here : https://github.com/jgm/pandoc/blob/master/MANUAL.txt#L1384.

And it is not the memory usage problem that can be solved with knitr::knit_meta(class=NULL, clean = TRUE)

As suggested here, update Pandoc can be the solution.

  1. Using rmarkdown::pandoc_version() check the pandoc version currently used to generate the Rmarkdown reports.
  2. Go on this website : https://pandoc.org/releases.html and check if the version you are using is the latest one.

For me it was not the case (I was using v2.6 of Pandoc and last one was v2.7.3) So I followed the tutorial from this page : https://pandoc.org/installing.html.

Then I checked if rmarkdown::pandoc_version() returned the latest version number and I reran my R script. It solved the problem.

这篇关于渲染多个 Rmarkdown 报告时出现 Pandoc 错误 1033的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆