我在使用rmarkdown将.rmd文件编织成.html(以及pdf(文件时遇到问题。我在下面的例子中试图编织的报告只是您在启动一个新的rmakrdown文档时得到的示例报告。
这是我收到的错误消息:
==> rmarkdown::render('C:/Users/***/Documents/test/test.Rmd', encoding = 'UTF-8');
processing file: test.Rmd
|.......... | 14%
ordinary text without R code
|.................... | 29%
label: setup (with options)
List of 1
$ include: logi FALSE
|.............................. | 43%
ordinary text without R code
|........................................ | 57%
label: cars
|.................................................. | 71%
ordinary text without R code
|............................................................ | 86%
label: pressure (with options)
List of 1
$ echo: logi FALSE
|......................................................................| 100%
ordinary text without R code
output file: test.knit.md
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.html --email-obfuscation none --self-contained --standalone --section-divs --template "\storage-***.sehome$****My DocumentsRwin-library4.0rmarkdownrmdhdefault.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:Users*****AppDataLocalTempRtmpc1mrLsrmarkdown-str511010115ff7.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --lua-filter "\storage-****.se/home$/****/My Documents/R/win-library/4.0/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "\storage-***-se/home$/*****/My Documents/R/win-library/4.0/rmarkdown/rmd/lua/latex-div.lua"
pandoc.exe: \: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted
Pandoc试图访问保存在我电脑上的文件,但由于某些原因找不到。这是我的工作电脑,所有内容都保存在本地,然后上传到服务器。我在办公室和IT部门谈过,他们不知道为什么它不起作用。以前,当我将所有内容(r项目、包和我进行分析的文件(移动到一个未上传到备份服务器的地图时,我成功地获得了一份rmarkdown报告。然而,这显然不是一种安全的方式,因为没有备份。我试着在当地做r项目来编织,但也不起作用。为什么pandoc找不到这个二进制文件?有没有一种方法可以让它在不冒工作安全风险的情况下工作?如果没有,有没有其他方法可以在没有pandoc的情况下创建类似的文件?
我看到过类似的问题,但没有什么能给我任何答案。或者向IT部门的人员提供任何线索。
谢谢!Johanna
以下是会话信息:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252
[3] LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C
[5] LC_TIME=Swedish_Sweden.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.2 htmltools_0.5.0 tools_4.0.2 yaml_2.2.1 rmarkdown_2.3
[6] knitr_1.29 xfun_0.16 digest_0.6.25 rlang_0.4.7 evaluate_0.14
版本:
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 0.2
year 2020
month 06
day 22
svn rev 78730
language R
version.string R version 4.0.2 (2020-06-22)
nickname Taking Off Again
> pandoc_version()
[1] ‘2.7.2’
> pandoc_available()
[1] TRUE
我已经解决了这个问题!
实际的问题是rmarkdown
包的路径。它在我的//storage
上。。。路径我最后要做的是进入系统设置,并将R_LIBS_USER
的环境变量添加到我的H:/
路径中。现在,当pandoc
正在查找rmarkdown
的详细信息时,它可以找到路径。
将此链接用作研究。尝试使用文件的RELATIVE路径。在这个例子中,您使用的是绝对路径C:/Users/,这会暂时更改R的工作目录。