如何解决rmarkdown中的此错误消息?

问题描述:

我才刚刚开始探索rmarkdown软件包.我不使用Rstudio.我使用默认的R环境.我所做的如下.

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.

我创建了一个新的R文档. 开始以rmarkdown格式键入几行. 用Rmd扩展名保存文件. 我将文件保存在工作目录中. 我使用pkg文件安装了pandoc. 我安装了"rmarkdown"软件包.装入包装. 使用以下命令呈现Rmd文件.

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")

我收到以下错误消息.

tools :: file_path_as_absolute(input)中的错误:文件'Untitled.Rmd' 不存在

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?

在大多数情况下,错误file not found是类型错误或实际丢失的文件(在您的情况下,真实文件是以另一种方式命名的) ).

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).

为了放弃这些可能性:

  1. 从文件浏览器复制完整路径.
  2. 确保文件存在,您可以在R中键入:

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

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

如果返回TRUE并且错误仍然存​​在,那么您怀疑还有其他事情在发生.

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