[R] Issues with loading csv file

Kevin E. Thorpe kevin.thorpe at utoronto.ca
Mon May 25 14:45:26 CEST 2015

On 05/25/2015 08:19 AM, Shivi82 wrote:
> HI All,
> I am trying to load an CSV file into the R project. the code for the same
> is:
> mydata<- read.csv("Jan-May Data.csv", header=TRUE)
> however with this I am getting the below error message:
> /*Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
>    cannot open file 'Jan-May Data.csv': No such file or directory*/
> I am under the impression that R automatically pulls the data from the
> working directory and we do not have to add the location where the file is
> saved. Please let me know if my understanding is correct and help on the
> error as well.
> Please note the csv file is already saved in the WD.
> Thank you, Shivi

The error message suggests that R is not finding the file. Are you sure 
it is in R's working directory? Try explicitly setting the working 
directory to the directory (folder) where your CSV file is. There is a 
menu option for this.


Kevin E. Thorpe
Head of Biostatistics,  Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael's
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.thorpe at utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016

More information about the R-help mailing list