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.
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.
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.
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