Error in file(file, “rt“) : cannot open the connection In addition: Warning message:In file(file, “

Error in file(file, “rt”) : cannot open the connection In addition: Warning message: In file(file, “rt”) : cannot open file ‘data.csv’: No such file or directory

目录

Error in file(file, “rt”) : cannot open the connection In addition: Warning message:In file(file, “rt”) : cannot open file ‘data.csv’: No such file or directory

问题:

解决:

完整错误:

Error in file(file, “rt“) : cannot open the connection In addition: Warning message:In file(file, “

问题:

如果没有设置全局的目录直接读取文件就找不到目录

#attempt to read in CSV file
df <- read.csv('data.csv')< code></->

解决:

第一,使用绝对路径(完整路径)

df <- read.csv('c:\\users\\test\\desktop\\data.csv', header="TRUE," stringsasfactors="FALSE)" < code></->

第二,配置程序环境的全局指定目录:

#display current directory
getwd()

[1] "C:/Users/xxx/Documents"

#set current directory
setwd('C:\\Users\\test\\Desktop')

完整错误:

attempt to read in CSV file

df

参考:R

参考:How to Fix: error in file(file, “rt”) : cannot open the connection

Original: https://blog.csdn.net/zhongkeyuanchongqing/article/details/120622857
Author: Data+Science+Insight
Title: Error in file(file, “rt“) : cannot open the connection In addition: Warning message:In file(file, “

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/638383/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球