【发布时间】:2015-11-20 06:29:23
【问题描述】:
我是 R 语言的新手。我正在用 R 编写一个 spark 程序。我想将输出保存到 hdfs 路径。我尝试了sink 方法
sink("/user/new/output/test.txt")
但它会引发错误。任何帮助将不胜感激。
确切的错误信息是
error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
Calls: sink -> file
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file '/user/new/output/text.txt': No such file or directory
Execution halted
【问题讨论】:
-
它会抛出什么错误?
-
指定的文件不存在
-
也许可以尝试在脚本开头使用
sink("/user/new/output/test.txt"),在结尾使用sink("/user/new/output/test.txt", append=TRUE) -
任何其他可能的方式将输出保存到指定路径?
-
仅在运行时创建输出文件