RStudioGD() 中的错误:阴影图形设备错误:r 错误 4(R 代码执行错误) [英] Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error)

查看:133
本文介绍了RStudioGD() 中的错误:阴影图形设备错误:r 错误 4(R 代码执行错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Rstudio 进行绘图.但是当我这样做时,plot(cars) 这是基本功能,我收到了 R 中的图形错误.
这是我所做的:

I am trying to plot using Rstudio. But when I do, plot(cars) which is the basic function, I am getting an Graphics Error in R.
Here is what I have done :

> plot(cars)
Error in RStudioGD() : 
  Shadow graphics device error: r error 4 (R code execution error)

请指导我.

推荐答案

最初,我将 RStudio 重新安装到最新版本 (1.1.442),并遵循了许多建议 R-base* 系统(升级到 R 3.4.3) 以下列方式使用 aptitude:

Initially, I reinstalled RStudio to the newest version (1.1.442) and, following many advice also the R-base* system (getting to R 3.4.3) using aptitude in the following way:

sudo aptitude 重新安装 libpangocairo-1.0-0 libpango-1.0-0sudo aptitude 重新安装 r-base r-base-core r-base-dev

我使用 aptitude 是因为它通常比 apt-get 更好地解开复杂的依赖树.之后,当没有包加载到环境中时,它工作得很好,但任何包加载都会产生各种与 DLL 相关的错误,如下所示.

I used aptitude because it is usually better than apt-get to disentangle intricate dependency trees. Afterwards, when no package was loaded into the environment it was working just fine but any package loading was creating a whole variety of DLL-related errors as follows.

最终解决方案(无需重新安装):

FINAL SOLUTION (NO NEED OF REINSTALL):

一旦我加载了我自制的库,错误就会再次出现.真正的问题是打开的 DLL 的数量.如果您加载太多包或文件,您将达到限制,并且您将在 达到最大 DLL 数量...无法加载 cairo DLL 之间出现错误消息(此错误警告)甚至 lapack 例程都无法加载.当我加载我的全部依赖项自制库时,我随机出现了这三个错误.

The error was showing again as soon as I loaded my self-made library. The real problem is the number of open DLL. If you load too many packages or files you will get to the limit and you will have error messages between maximal number of DLLs reached... or failed to load cairo DLL (this error warning) or even lapack routines cannot be loaded. I had these three error randomly as I loaded my full-of-dependencies-homemade-library.

于是我又开始寻找解决方案.最后一个是允许更多的 DLL 并且这样做足以将环境变量 R_MAX_NUM_DLLS 设置为更高的数字(我将其设置为 500).为了避免每次阅读?Startup文档时都设置它的麻烦,从而在Renviron文件R-HOME/etc/中写入R_MAX_NUM_DLLS=500Renviron.site.就我而言(Ubuntu:16.04 是 /usr/lib/R/etc/Renviron.site.这顺利解决了问题.

So I started again looking for a solution. The final one is to allow more DLL and to do so it is enough to set the environmental variable R_MAX_NUM_DLLS to a higher number (I set it to 500). In order to avoid the hassle of setting it every time you can read ?Startup documentation and consequently write R_MAX_NUM_DLLS=500 in your Renviron file R-HOME/etc/Renviron.site. In my case (Ubuntu:16.04 it was /usr/lib/R/etc/Renviron.site. This fixed smoothly the problem.

这篇关于RStudioGD() 中的错误:阴影图形设备错误:r 错误 4(R 代码执行错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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