I have encountered this error trying to plot using rnotebook:
Error in (function (filename = "Rplot%03d.png", width = 480, height = 480, : unable to start png() device.
This is the code I am trying to run in Rnotebook
N <- 100
a <- rnorm(N)
b <- a + rnorm(N)
df1 <- data.frame(a, b)
ggplot(df1, aes(b)) + geom_histogram()
If I run it outside of rnotebook it works fine.
I have checked the issue in several other discussion boards but to no avail. Either the issue is beyond me or I am not able to really come down to a workaround. These are some the discussion boards I have checked:
- r - error in rmarkdown when plotting - Stack Overflow
- r - Error : Unable to start png() device - Stack Overflow (this one indicates a change in a the file name of the graph, but I actually don't set the name Rplot%03d.png. This just appears this way in the error output)
I have to add that if at times I decide to just restart the R session or just close it altogether. Then the issue "disappears" and I can see the plots, but I don't think that is the desirable way it should work.
Any help regarding this issue will be highly appreciated.