【发布时间】:2013-07-24 01:17:16
【问题描述】:
我在 R 脚本中遇到“无法打开连接”错误。详情如下:
> write.csv(table1.fiveReitWts,file="C:\\Users\\John Broussard\\Dropbox\\evtHandbookProject\\figuresTables\\figure3Data.csv")
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'C:\Users\John Broussard\Dropbox\evtHandbookProject\figuresTables\figure3Data.csv': No such file or directory
>
这是一个正在创建的新文件,但该目录存在。我可以看到包含其他文件的目录。我之前成功使用过这段代码,但是突然之间,我无法将文件写入该目录。
我可以提供哪些其他信息来帮助您解决此错误?
【问题讨论】:
-
顺便说一句,我以前没有见过这个错误,因此很困惑。
-
你的硬盘满了吗?
-
@gung,我认为双反斜杠 (\\) 可以解决 Windows 中的问题。
-
想到两件事:1) 一个错字,请仔细检查。另外,如果你在那个目录中运行
list.files("C:\\Users\\John Broussard\\Dropbox\\evtHandbookProject\\figuresTables")或setwd,你会得到什么? 2) 文件权限:请检查您对该目录有写入权限。 -
这是运行 list.files() 时的结果 list.files("C:\\Users\\John Broussard\\Dropbox\\evtHandbookProject\\figuresTables") character(0)跨度>
标签: r