0

My RStudio session is crushing when trying to draw an rgl 3d plot using knitr in ioslides html presentation. Any ideas how to prevent it?

My chunk:

```{r setup, results='asis'}
library(knitr)
library(rgl)
knit_hooks$set(webgl = hook_webgl)
```

```{R, testgl, webgl=TRUE, cache=FALSE}
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))
```

Edit

This error occurs for:

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] rsconnect_0.4.1.4 htmltools_0.2.6   tools_3.2.1       yaml_2.1.13       rmarkdown_0.7     digest_0.6.8     
> 

Source code for the presentation can be found here:

https://github.com/TARF/SMM/tree/master/Presentation

Please note that in order to run the code one needs to connect to Human Mortality Database via Demography package with own credentials.

Leni Ohnesorge
  • 716
  • 8
  • 19

1 Answers1

0

You probably need to update RStudio. I had it crash for a while, I think because their WebGL implementation wasn't working; now it runs fine (though it doesn't display WebGL, I have to view the output in my browser for that).

Edited a couple of years later: I haven't seen a crash in a long time, and rgl (displayed by calling rglwidget()) now displays fine in RStudio.

user2554330
  • 37,248
  • 4
  • 43
  • 90
  • I think you'll need to give enough details for someone to reproduce the crash. Post a complete .Rmd document, and list sessionInfo from R, as well as the RStudio version number. – user2554330 Sep 09 '15 at 10:47