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

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

问题:

解决:

完整错误:


问题:

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

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

解决:

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

df <- read.csv('C:\\\\Users\\\\test\\\\Desktop\\\\data.csv', header=TRUE, stringsAsFactors=FALSE)

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

#display current directory
getwd()

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


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

完整错误:

> #attempt to read in CSV file
> df <- read.csv('data.csv')
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

参考:R

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

以上是关于Error in file(file, “rt“) : cannot open the connection In addition: Warning message:In file(file, “的主要内容,如果未能解决你的问题,请参考以下文章

IAR报错笔记“Could not open macro file“ 与 “Error in macro file“

如果遇到php5.6 上传图片error代码为6 或者 报错“PHP Warning: File upload error - unable to create a temporary file in

CMake error:System Error:No such file or directory CMake error:Could not open file for write in cop

IAR报错笔记“Could not open macro file“ 与 “Error in macro file“

IAR报错笔记“Could not open macro file“ 与 “Error in macro file“

MySQLInnoDB: Error: checksum mismatch in data file 报错