[Solved] R Language Error: Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error)

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

 

Solution:

Solution 1: Ctrl + Shift + F10 to restart your session
solution 2: run the following code directly to regenerate the temporary file without restarting (recommended)

dir.create(tempdir())

Read More: