'R rgl Package crashes Rstudio

Does anyone use R rgl package (version 0.95.1201) in Rstudio (Version 0.99.489)? Every time I call library(rgl), Rstudio crashes.

Update

I updated rgl by installing version 0.95.1367 from source. Rstudio still crashes. But when I run it in R GUI or R in terminal, there is no problem. Recently I updated my XQuartz to 2.7.9_beta1. I am not sure if this could be the reason.

My system is: Mac OSX Yosemite 10.10.5

enter image description here



Solution 1:[1]

I had the exact same problem.

You have to set the environment variable:

LIBGL_ALWAYS_SOFTWARE=1

In R, the command is:

Sys.setenv(LIBGL_ALWAYS_SOFTWARE=1)

It should work now.

Solution 2:[2]

install latest RTools to default folder (C:\rtools##) from here
check RTOOLS##_HOME envvar is in your path
install devtools package
install rgl package from github sources, with a line
devtools::install_github("dmurdoch/rgl")
the problem should go away

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike
Solution 2 ivan866