read.table() and read.csv both Error in Rmd

安稳与你 提交于 2019-11-28 07:25:36

The short answer is:

KNOW THY getwd()

Do not confuse the working directory of your current R console with the working directory of your R Markdown document (which is the directory of this R Markdown document). When in doubt, print out getwd() where you want to know your working directory (e.g. in *.Rmd). Note R Markdown documents are compiled in separate R sessions to enhance reproducibility, so you current R console has nothing to do with the compilation of the R Markdown documents.

Just try and place all your data file where your Markdown (.Rmd) file resides.

Mine is a silly case, but may happen to someone else... the Rmd had been saved to my default working directory not the current working directory where I thought I was. I had a long list of files and didn't realize the script was not there. Worth to check!

Your current RMD file is not in your current working directory

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