Error in plot.new() : unable to open file '' for writing

rstudio

#1

Hello all,

When running code in RStudio, I am getting the following error message whenever I try to run a plot function.
Error in plot.new() :
unable to open file '' for writing

Generally I am able to just re-run the code and it will work, however, I am now trying to create multiple plots through a for loop and this error will stop me after a random number of plots. Does anyone know why this might be happening?

Thanks!

*I have run the for-loop 4 times and have generated 5, 8, 3, and 4 plots, respectively, before the error message stops my for-loop prematurely.