r - 从共享驱动器呈现 rmarkdown 时出现问题
问题描述
当我的 RMD 文件位于共享驱动器上时,我无法呈现降价文件。我正在使用 rmarkdown 版本 1.12、R 版本 3.5.3、64 位 Windows 10、pandoc 2.7.1。
我无法呈现为 html、pdf 或 word doc。
这失败了(我的文件夹路径中没有空格或标点符号):
rmarkdown::render("//cor.local/subfolders/Martin/aNewRMD.RMD")
但这成功了:
rmarkdown::render("C:/Users/Martin/Documents/aNewRMD.RMD")
(我只是使用 RStudio 打开的默认新 .RMD 文件)。
错误信息:
processing file: aNewRMD.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: aNewRMD.knit.md
"C:/Pandoc/pandoc" +RTS -K512m -RTS aNewRMD.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output aNewRMD.html --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\Martin\Documents\R\win-library\3.5\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\Martin\AppData\Local\Temp\RtmpGoqMWG\rmarkdown-str421411883120.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
pandoc.exe: aNewRMD.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
解决方案
我相信 R 不知道(还)如何说出网络共享的任意 URI。虽然我猜测某些功能(和其他包)可能支持其他方案,但download.file
帮助页面说
The function 'download.file' can be used to download a single file
as described by 'url' from the internet and store it in
'destfile'. The 'url' must start with a scheme such as 'http://',
'https://', 'ftp://' or 'file://'.
您正在做的"//cor.local/subfolders/Martin/aNewRMD.RMD"
是告诉它向名为(以某种方式进行身份验证)的主机说出 Windows 文件共享协议(smb、cifs 等)cor.local
并导航到相应的子目录。
我的建议:让 windows 提前处理基本身份验证,并“挂载”它,以便本地计算机上的每个应用程序都将其视为“本地”,但将其挂载到驱动器号:
C:\Users\AM4337> net use /user:yourdomain\youruser g: \\cor.local\subfolders
(它应该询问您的密码),然后在本地使用/处理它
R> rmarkdown::render("G:/Martin/aNewRMD.RMD")
推荐阅读
- kubernetes - 永远调试处于 Completed 状态但尚未准备好的 kubernetes pod
- python - 在循环中更新 pyplot 图例
- python - 如何让 MIMEText 呈现 HTML?
- java - 为 gradle 添加实现以添加广告时出错
- symfony - 删除 Symfony4 的外键和级联问题
- javascript - 循环包含 Javascript 中的 Ajax 调用的函数
- android - 无法从 Android Studio 4.0 Canary 拉/推 git
- java - 如何使用 RESTHightLevelCient 执行包含多个字符串的搜索
- python - 将 CSV 文件转换为 HTML 并使用 Pandas 在浏览器中显示
- python - 理解 Django 应用程序依赖项的问题