R rgl package error while loading the library
Asked Answered
O

4

5

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?

Orthopedic answered 20/2, 2015 at 16:24 Comment(0)
A
9

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 ...

Adela answered 4/11, 2016 at 19:31 Comment(0)
M
2

rgl appears to be working with RStudio. I'd make sure you have XQuartz installed on your system https://xquartz.macosforge.org/landing/ as X11 is no longer included with OS X by default. Let us know if it's still not working for you.

Mccluskey answered 20/2, 2015 at 16:36 Comment(0)
V
1

Start XQuartz before loading the rgl package. rgl displays images in an XQuartz window, but it does not seem to be able to open a RGL device window from within R when XQuartz is not already running. This works with Mac OS 10.11.3, XQuartz 2.7.8, R 3.2.3.

Vespers answered 23/2, 2016 at 10:41 Comment(1)
This worked for me (simply launching XQuartz first).Univalent
I
1

Detection of XQuartz on Mac OS is a little flaky. The latest rgl (version 0.95.1456) on R-forge might do better.

Isoniazid answered 28/2, 2016 at 14:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.