R rgl package error while loading the library

r rgl
user67275 picture user67275 · Feb 20, 2015 · Viewed 9.2k times · Source

My system environment:

Mac OS 10.10.2

X11 (XQuartz 2.7.5)

R 3.1.2

When I load and use 'rgl' package, I get following error message.

> library("rgl",lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: In fun(libname, pkgname) : error in rgl_init
> plot3d(x,y,z)
Error in rgl.open(useNULL) : rgl.open failed

What's the problem?

Answer

HVakade picture HVakade · Nov 4, 2016

I was already using rstudio when I got this warning. This seemed to work for me as suggested on https://cran.r-project.org/web/packages/shinyRGL/README.html.

  1. I ran this on R console options(rgl.useNULL=TRUE)
  2. I restarted the session using .rs.restartR()
  3. Loaded the library again: library("plot3Drgl")

HTH ...