How to solve this error message in rmarkdown?

送分小仙女□ 提交于 2019-12-10 12:43:22

问题


I am just starting to explore the rmarkdown package. I don't use Rstudio. I use the default R environment. What I did was as follows.

I created a new R document. Started typing few lines in rmarkdown format. Saved the file with Rmd extension. I saved the file in the working directory. I installed the pandoc using the pkg file. I installed 'rmarkdown' package. Loaded the package. Used the following command to render the Rmd file.

rmarkdown::render("Untitled.Rmd")

I get the following error.

Error in tools::file_path_as_absolute(input) : file 'Untitled.Rmd' does not exist

I tried all the possible ways such as giving the exact path instead of filename etc. But nothing worked out. I googled the error message and found that none had similar error. Can someone help me with this. What I am missing. What the error message mean?


回答1:


Most of the time the error file not found is either a type error or a real missing file (as in your case, the real one is named in another way).

In order to discard those possibilities:

  1. Copy the fullpath from your filebrowser.
  2. Make sure the file exists, inside R you could type:

    file.exists("/fullpath/to/file")

If that return TRUE and the error persists, then you suspect another thing is going on.



来源:https://stackoverflow.com/questions/26616202/how-to-solve-this-error-message-in-rmarkdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!