Strange warning on initial RStudio statement

Hi all -

I'm getting a weird warning for any code that I run right after I've opened RStudio or, if it's open, after the computer wakes from sleep. I can't make it repeat reliably, but it does frequently happen.

After any initial statement, even just a simple assignment statement, I get a series of warnings:

> x <- rnorm(100)
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
  display list redraw incomplete
2: In doTryCatch(return(expr), name, parentenv, handler) :
  invalid graphics state
3: In doTryCatch(return(expr), name, parentenv, handler) :
  invalid graphics state
> x <- rnorm(100)

In the example above, x <- rnorm(x) still executes, and I can still use the result. Further, after running that same statement a second time, I don't get the warning. So it's not hindering anything I'm trying to do, but I'd like to know why it's happening.

I've been using RStudio for about two years, and it's only been in the past few months that I've had the issue. I don't use the regular R gui all that often, but I haven't noticed it when I've tried to replicate the error there. I had been on R version 3.6.1 (and a similar older version of RStudio), but recently upgraded to R 3.6.3 and RStudio 1.2.5033. This warning occurred both before and after the upgrades.

Any ideas on what might be causing it?


Do you have a plot displaying in the Plots pane? If so, how was that plot generated?

Most likely, something is going wrong while RStudio is using the graphics device. If you can provide any extra context (e.g. what sort of plots you're generating, how you're generating them, and so on) that may help us find a solution.

There wasn't a plot generated from the code above. This often happens for the first code I run when opening RStudio, before I've run anything graphic related. What you saw was exactly what happened. I ran a simple rnorm statement, no graphics involved, and got the warning.

IOW, I'm getting a graphics error when I'm not running any code that would use the graphics device.

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