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

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


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.


Your current RMD file is not in your current working directory


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