This error typically looks like this …

> df <- read.csv("no-header.csv")
Warning in file(file, "rt"): cannot open file 'no-header.csv': No such file or directory
Error in file(file, "rt"): cannot open the connection

The most common reasons for this error are as follows

  • You have misspelled the actual name of the file.
  • You have not changed the working directory to where the data file is saved. See this FAQ on how to change the working directory. Make sure you change the working directory to where your file is actually saved.
  • You have not saved the file as a CSV file. Most commonly you saved it as an Excel file. Saving an Excel file as a CSV file is described in this R Tutorial video.