我想问一下是否可以使用R将文本文件(如Word文档或文本文档)转换为PDF?我考虑使用以下代码将其转换为.Rmd,然后再转换为PDF:
require(rmarkdown)
my_text <- readLines("C:/.../track.txt")
cat(my_text, sep=" \n", file = "my_text.Rmd")
render("my_text.Rmd", pdf_document())
但是它并没有起作用,显示了以下错误:
> Error: Failed to compile my_text.tex.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "my_text.tex"' had status 127
有没有其他解决方案?
MikTeX
和pandoc
。 - Tung