r error 4 (R code execution error) unable to generate plot


I wondered if someone might be able to help?

Using R-Studio I ran a parallel analysis as part of fa. All worked fine except a PA scree plot has not appeared in Plots, in previous uses of this, a scree plot was automatically generated.

I received the following error message

Error in RStudioGD() :

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

In addition: There were 50 or more warnings (use warnings() to see the first 50)

> parallel.res

Error in file(out, "wt") : cannot open the connection

Error in file(out, "wt") : cannot open the connection

Error in file(out, "wt") : cannot open the connection

Any advice gratefully received.

Thanks Louise


In order for us to help you with your question, please provide us a minimal reprocudible example where you provide a minimal (dummy) dataset and code that can recreate the issue. One we have that, we can go from there. For help on creating a Reprex, see this guide:

Good luck!

Hi Louise! Welcome!

I agree with @pieterjanvc that it would help to have some runnable code that reproduces this problem, but before that: can you check to see if this is an RStudio-specific problem, or something that also happens in R outside of RStudio?

Here's how:

  1. Run the code that you expected to produce your plot in R outside of RStudio. That could be via:

    • Running the default R GUI app that was installed when you installed R (Rgui.exe on Windows, and R.app on macOS)
    • Running R in your terminal
  2. Do you get a plot? Do you see the same errors?

(if all the talk of "R outside RStudio" above made you suddenly feel :dizzy_face:, you might want to take a look at: Differentiating R from RStudio)

1 Like

Thank you jcblum and @pieterjanvc for taking time to respond with these potential solutions. Earlier today, I found another online source suggesting that this problem can be resolved by uninstalling and then re-installing R-studio, which I did. Five hours later, I have re-run the PA, the problem has resolved and all is well once more! Phew!
Thanks again for your suggestions, this is a great forum :slight_smile: Louise

1 Like

Glad to hear you solved your problem! :relieved:

Would you mind officially marking your post describing what worked as the solution? It helps other people see which questions still need help, or find solutions if they have similar problems. :grinning: Here’s how to do it:

Got, it - thanks again for your help :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.