全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3347 3
2014-03-28
为什么我已经setwd了,可是read.table就是报错。我getwd(),显示的路径没问题,可是路径里面的txt文件就是读取不出来。有哪位老师可以解答一下吗?

read.table("abc.txt")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : cannot open file 'abc.txt': No such file or directory
> getwd()
[1] "D:/rtemp"
> read.table("D:/rtemp/abc.txt")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'D:/rtemp/abc.txt': No such file or directory
>

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-3-28 11:06:38
之前同遇到,你把txt文件再重新加到你的getwd()的路径下试试,read.table()读出的是数据框,你的txt里面的如果是纯数据,这样读就可以;如果是带分隔符的文件还要加一些参数设置之类。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-3-28 13:28:52
确定你的abc.txt文件在那个目录里?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-3-29 14:10:08
qoiqpwqr 发表于 2014-3-28 13:28
确定你的abc.txt文件在那个目录里?
好了,不知道为什么,我确定文件在那个文件夹里,换了几次地方突然一下子就好了。。。thank you all the same !
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群