首页 > 解决方案 > R Markdown - 如何导出为 PDF 文件?

问题描述

我无法将 R markdown 导出到 PDF 文件(或 Word)。

我打开了一个新的“R markdown”文件,只需使用模板并将其重命名为 test.Rmd。

但是,这对我不起作用:

render("test.Rmd", output_format = "pdf_document")
Error in abs_path(input) : The file 'test.Rmd' does not exist.
In addition: Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
  path[1]="test.Rmd": The system cannot find the file specified

这很奇怪,因为我在桌面上保存了 test.Rmd。

另外,我尝试单击“Knit”>“Knit to PDF”> 给我这个错误:输出文件:test.knit.md

pandoc.exe: test.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted

我尝试过但没有帮助的方法:

install.packages('tinytex')
tinytex::install_tinytex()

谁能帮我这个?顺便说一句,我使用的是企业计算机,因此我无法下载 R 之外的任何外部应用程序。

标签: rr-markdown

解决方案


推荐阅读