无法打开文件“",原因是没有这样的文件或目录 [英] Cannot open file '', reason No such file or directory

查看:147
本文介绍了无法打开文件“",原因是没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下问题,在Rserve中的R中运行代码时,有时会发生 .到目前为止,我无法复制它.

I've run into the following problem, which sometimes happens when running the code in R under Rserve. So far I was unable to replicate this.

我首先使用

pdf(file=paste(output.dir, "/dates_",name,".pdf",sep=""),width=6.25,height=9,title="Breakdown Dates:")

然后绘制数据:

plot(time, data1, xlab="", ylab="")

大多数情况下,当它失败时,我会收到错误消息:

Most of the time it works, when it fails I get the error:

无法打开文件",原因是没有这样的文件或目录

cannot open file '', reason No such file or directory

我已经重新运行了这个程序,并调试了多次,一切正常.但是,有时在生产中会失败.目前,我怀疑是RServe还是文件系统.

I've rerun this and debugged multiple times and all is working fine. However, sometimes in production it fails. Currently I suspect either the RServe or the file system perhaps.

任何想法都将受到欢迎.

Any ideas would be welcome.

推荐答案

file.path在文件系统中的可移植性要比paste大,因为它会自动设置适当的目录分隔符.仅将paste(或paste0)用作文件名:

file.path is more portable across file systems than paste, as it automatically sets appropriate directory separators. Use paste (or paste0) for just the filename:

pdf(file=file.path(output.dir, paste0("dates_", name, ".pdf")), 
    width=6.25,height=9,title="Breakdown Dates:")

这篇关于无法打开文件“",原因是没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆