Reputation: 39
yes I know there are many threads to this above mentioned error, but (at least I) wasn't able to find a solution. So RStudio gives me the following error while trying to plot something:
Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error)
It seems to be a problem with R supporting jpeg and png. Running in R environment
>capabilities()
jpeg png tiff tcltk X11 aqua
FALSE FALSE FALSE FALSE FALSE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE FALSE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE FALSE FALSE TRUE TRUE TRUE
shows exactly that. cairo and pango are installed. And I have no idea what else to do. Here you can find the code I'm trying to run. I installed the packages magrittr, ggplot2, dplyr, cowplot and patchwork. Furthermore I'm running the latest RStudio version on linux. R itself is also updated.
Thanks in advance.
EDIT: For anyone stumbling over the same problem: A complete re-installation of R, RStudio and most depencies solved the problem somehow.
Upvotes: 3
Views: 2294
Reputation: 351
I am using R version 3.6.3 (built from source) and RStudio 1.2.5033, on Amazon Linux 4.14.154-99.181.amzn1.x86_64. I first did:
sudo yum -y install libX11-devel
I then re-installed R from source using the following options
sudo ./configure --prefix=/opt/R/$3.6.3 --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack --with-x=yes --with-readline=no
The key here is --with-x=yes. Finally I did:
sudo make
sudo make install
After that I was able to generate plots within RStudio. For reference, my capabilities are now:
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets libxml fifo
FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE
cledit iconv NLS profmem cairo ICU long.double libcurl
FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
Upvotes: 0
Reputation: 21
A bit late, but today I had the same problem. I restarted my session with Ctrl + Shift + F10 and it worked.
Upvotes: 2