Unable to open file in R studio

I uploaded my all of my data into R studio via the "import dataset", however the file is not being recognized when I attempt to use the read.csv function. I tried to use path.expand and setwd but it still hasnt worked out. I have attached screenshots of the result. Any advice/solution?

If you have already loaded your data in memory using "import dataset" (your image shows that is already in your global environment), why you are trying to load it again using read.csv? The problem with this is that you are using a wrong file path

I see, so read.csv is just the manual way of importing the data? With regards to using the wrong file path - can you elaborate as I have just began learning R studio.

Yes, it is one way (among others)

This has nothing to do with R, you just have to check that the file path is correct, since you are just passing the name of the file, R is looking into your default working directory (your home directory by default) and finding nothing.

Thank you so much! I appreciate the help!

I find the best way is to check the "properties" of your file.

Then copy and paste it to R

setwd("insert your location here")
table1 <- read.table("inserttablenamehere.csv", header=TRUE, sep=",", stringsAsFactors=FALSE)

You have to be careful with copying from windows as all should be / in you directory and not \

Just another way that might help :slight_smile:

1 Like

Thank you so much I appreciate the help!! :slight_smile:

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