使用REngine.Rserve时出现Plot()错误 [英] Plot() error when using REngine.Rserve

查看:81
本文介绍了使用REngine.Rserve时出现Plot()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在一个项目中工作,该项目希望使用org.rosuda.REngine.Rserve来使用C​​#的R功能.我有一个特殊的问题,当我在C#客户端运行以下代码时:

I'm now work on a project which wants to use org.rosuda.REngine.Rserve to use facilities of R by C#. I have a particular problem that when I run the following code in C# client side:

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

出现错误消息

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

但是我检查了"pdf .."功能是否已成功创建文件"plots.pdf".在R语义中,连续的plot()会将图形输出到通过"pdf(...)"函数打开的活动设备,即这次是"plots.pdf".但是我很困惑,为什么错误指出文件是." 我在Linux服务器端使用R-2.15.0和Rserve-1.7.0. 我渴望看到您的回应. 非常感谢.

But I checked that the file "plots.pdf" has already been created successfully by "pdf.." function. In R semantics, the successive plot() will output figure to the active device opened by the "pdf(...)" function, i.e. "plots.pdf" this time. But I'm very confused that why the error indicated that the file is ''. I use R-2.15.0 and Rserve-1.7.0 in linux server side. I'm eager to see your response. Thanks a lot.

推荐答案

名为 (null).1001.1001

A folder named (null).1001.1001

有关答案 无法打开文件",原因没有这样的文件或目录 建议使用file.path替代paste来创建具有平台无关路径分隔符的文件名.

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.

评论建议dev.off(). graphics.off()我的运气更好.区别在于dev.close()关闭当前设备,graphics.off()关闭所有打开的设备.

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.

但是我的解决方案却是 https://askubuntu.com/questions/721485/what-is-folder-null- 1001-1001 我发现了一个名为(null).1001.1001的神秘文件夹(Rserve在Linux上以uid 1001和gid 1001的身份运行).我在会话开始时创建了此文件夹,我很高兴.在我看来,此文件夹的存在似乎有所帮助,但我不知道(至今!)该文件夹是什么.

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.

这篇关于使用REngine.Rserve时出现Plot()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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