2

我遇到了以下问题,有时在 Rserve 下运行 R 中的代码时会发生这种情况。到目前为止,我无法复制这一点。

我首先创建一个PDF

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

然后绘制数据:

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

大多数时候它工作,当它失败时,我得到错误:

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

我已经重新运行并调试了多次,一切正常。但是,有时在生产中它会失败。目前我怀疑可能是 RServe 或文件系统。

任何想法都会受到欢迎。

4

1 回答 1

2

file.path比 更可跨文件系统移植paste,因为它会自动设置适当的目录分隔符。仅使用paste(或paste0)作为文件名:

pdf(file=file.path(output.dir, paste0("dates_", name, ".pdf")), 
    width=6.25,height=9,title="Breakdown Dates:")
于 2013-05-28T18:10:19.737 回答