Error in file(file, "rt") : cannot open the connection with R in Python
I am a newbie 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 the correct directory.
My app throw an Error in file(file, "rt") : cannot open the connection.
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(file[i], header = T, sep = ",") datamean3("file", "data", 1:10) In addition: Warning message: In file(file, "rt") : cannot open file './file.csv': No such file or directory
How can I fix it?
Thanks for any suggestions.
Blue Jame Aug 22 2021
To fix this, you have to specify the working directory were out csv file is stored using the
setwd("D:/Projects/Python/ExamplePL/") # Change working directory
Now, we can execute exactly the same code as below:
product_data <- read.csv("product_data.csv") # Properly import data
And it works for me.
Trump McDonald Aug 22 2021
Just change your
directory <- ("./file")to
directory <- ("./file/")
so just don't make
filefolder you are working on.