使用Rmarkdown生成html文件非常實用,但是如果在Rstudio進行的話會有一段時間不能操作界面魁兼。
今天我嘗試在linux系統(tǒng)用R命令行進行這個步驟,使用如下命令:
rmarkdown::render('index.Rmd',output_file='index.html')
但是卻報錯:
Error: pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
最后使用了Rstudio的pandoc解決了這個問題漠嵌,歐耶??
-- 在Rstudio找出pandoc路徑在哪里
Sys.getenv("RSTUDIO_PANDOC")
在linux R命令行里引入pandoc咐汞,再運行rmarkdown
Sys.setenv(RSTUDIO_PANDOC="/usr/lib/rstudio-server/bin/pandoc")
rmarkdown::render('index.Rmd',output_file='index.html')