Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error)

后端 未结 8 1623
渐次进展
渐次进展 2021-01-08 00:32

I am trying to plot using Rstudio. But when I do, plot(cars) which is the basic function, I am getting an Graphics Error in R.
Here is what I h

8条回答
  •  感情败类
    2021-01-08 00:46

    I had the same error and am on Ubuntu. I did not install R through sudo apt-get install r-base but instead downloaded a specific version, unpacked it and installed it manually with:

    ./configure --with-readline=no --with-x=no --enable-R-shlib
    make
    sudo make install
    

    I did not have cairograpghics installed, which is apparently important to build 2D graphics with R. So I installed that with:

    sudo apt-get install libcairo2-dev
    

    Or find the version for your OS here: https://www.cairographics.org/download/

    I then uninstalled R again by simply going into the downloaded R folder that I had previously compiled using the above commands mentioned and typed:

    sudo make uninstall
    

    And then I configured and installed the same R version again. That did it. The uninstall and reinstall was important, just installing cairographics didnt work, you have to have it installed before using ./configure.

提交回复
热议问题