[英]Problems rendering rmarkdown from shared drive
我的RMD文件位於共享驅動器上時,無法渲染markdown文件。 我正在使用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"
所做的工作是告訴它與名為cor.local
的主機進行Windows文件共享協議(smb, cor.local
等)(以某種方式進行身份驗證)並進行導航到各自的子目錄。
我的建議:讓Windows提前處理基本身份驗證,然后“掛載”它,以便本地計算機上的每個應用程序都將其視為“本地”,但將其安裝到驅動器號上:
C:\Users\AM4337> net use /user:yourdomain\youruser g: \\cor.local\subfolders
(它應該詢問您的密碼),然后在本地使用
R> rmarkdown::render("G:/Martin/aNewRMD.RMD")
組織升級到Windows 10后,多個用戶試圖運行現有的R進程時遇到了相同的問題:“錯誤:pandoc文檔轉換失敗,錯誤1”。
將項目文件夾更改為RStudio項目可以解決此問題。 RStudio項目使用每個用戶的本地路徑設置其自己的工作目錄,因此將網絡路徑替換為帶字母的本地路徑。 感謝@ r2evans解釋此問題並啟用此替代方法。
(為單獨的答案表示歉意,我不敢評論@ r2evans的答案。)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.