使用REngine.Rserve当图()错误(Plot() error when using REn

2019-06-28 08:46发布

我现在上要使用org.rosuda.REngine.Rserve通过C#使用的R设施项目。 我有一个特别的问题,当我运行在C#客户端下面的代码:

c.eval("pdf(file=\"plots.pdf\", width=11, height=8.5)");
c.eval("plot(1,2)");

错误occour其说

Error in plot.new():cannot open file '', reason No such file or directory

但是我检查了文件“plots.pdf”已成功通过“PDF ..”功能创建。 就R语义,逐次积()将输出数字由“PDF(...)”功能,即“plots.pdf”这次打开有源器件。 但我很困惑的是,为什么错误表明,该文件是“”。 我用在Linux服务器端R-2.15.0和Rserve-1.7.0。 我渴望看到您的回复。 非常感谢。

Answer 1:

试试这个代码: -

c.eval("dev.off()")


Answer 2:

A folder named (null).1001.1001


Related answer at Cannot open file '', reason No such file or directory suggests using file.path as a alternative to paste for creating filenames with platform-independent path separators.

Comments suggest dev.off(). I had better luck with graphics.off(). The difference is that dev.close() closes the current device, graphics.off() closes all open devices.

But my solution turned out to be https://askubuntu.com/questions/721485/what-is-folder-null-1001-1001 I found a mysterious folder named (null).1001.1001 (Rserve is running as uid 1001, gid 1001 on Linux). I create this folder at the start of my session and I'm good to go. The presence of this folder seems to help in my case, but I don't know (yet!) what that folder is.



文章来源: Plot() error when using REngine.Rserve
标签: r plot rserve