Frustration with importing CSV

Hi everybody,
I am a new R user, and I am probably making some obvious mistake with RStudio 2022.07.1 Build 554, and I use Windows.
I am having a very frustrating problem importing csv files using the pathway to the file. Note that I can open the same file by using the "Open file" function in RStudio. It is just want to learn what I am doing wrong with the standard R open CSV approach. Here is what I entered and the errors that I received:

path <- "C:\Users\kochendj\Documents\Rfiles\import_test.csv"
content <- read.csv(path)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C:\Users\kochendj\Documents\Rfiles\import_test.csv': No such file or directory

Can someone give me an idea what I am doing wrong. The pathway is right. I used properties on the CSV file to see the pathway, and I copied and pasted it into R . Thanks very much.

Clarification on just submitted topic by Chess22.

I just say that when I submitted the topic "Frustration with importing CSV, all of my double backslashes were converted to single backslashes. This is not the problem that I am having. In RStudio, I have all double backslashes.



To confirm your path exists.

If it does exist use


to list the file present there

1 Like

Try single forward slashes:

path <- "C:/Users/kochendj/Documents/Rfiles/import_test.csv"


You have to use normal slashes, e.g. "/" inside paths, not backslashes. Using 'C:/Users/kochendj/Documents/Rfiles/import_test.csv' should be sufficient I think.

Edit: @fcas80 answered this already. Credits to him. :smiley:

1 Like

if you want my advice use the package readxl


then apply the following command :

data <- read_excel(file.choose())

it will open for you a window directory ,, its more easier to work with to chose your file where its located
rather than wasting time and looking for the path which may differ from the place where you are saving your folders .
its really frustrating to lookup every time on the path directory especially if your working file are saved on onedrive or other folder

Kind Regards

For find the correct path you could use file.choose() in the console.

Show a new window for find and select the file.

Finally show the correct path in the console for copy and paste in the script.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.