• Register
0 votes

Problem :

I am very new to the R, and after researching my error as below extensively, I am still unable to find the fix for it. I have already checked my working directory, and also made sure that the files are in a correct directory.

Error in file(file, "rt") : cannot open the connection file(file, "rt") read.table(file = file, header = header, sep = sep, quote = quote,dec = dec, fill = fill, comment.char = comment.char, ...)
read.csv(specdatapaths[i], header = T, sep = ",")pollutantmean3("specdata", "sulfate", 1:10)
In addition: Warning message:
In file(file, "rt") : cannot open file './specdata001.csv': No such file or directory


by (7.5k points)  

1 Answer

0 votes

Solution :

I had spent a lot of time in recent past trying to understand what was actually wrong with my code.

And it seems to be very simple if you are using windows.

When you name the file "xyz.txt" then your windows name it as "xyz.txt.txt"... That will be the same with .CSV files as well so windows create the file named "007.csv.csv" if you called it "007.csv"

So, whenever you try to create your .csv file, you just rename it as"007" and open it in the R using below command :


 It will work for you as it works for me.

by (36.1k points)