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.
-
B-1
Blue Jame Aug 22 2021
To fix this, you have to specify the working directory were out csv file is stored using the
setwd
function: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.
-
T-1
Trump McDonald Aug 22 2021
Just change your
directory <- ("./file")
todirectory <- ("./file/")
so just don't make
file
folder you are working on.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.