Re: [Rd] Problems caused by dev.off() behaviour

2023-10-03 Thread Avi Gross
Just pointing out that if you do not want to SEE an error message that is otherwise harmless, one option in R is to let the error happen but arrange to deal with it in some way including just suppressing the message. On Tue, Oct 3, 2023, 5:27 AM Duncan Murdoch wrote: > On 02/10/2023 10:17 p.m.,

Re: [Rd] Problems caused by dev.off() behaviour

2023-10-03 Thread Duncan Murdoch
On 02/10/2023 10:17 p.m., Trevor Davis wrote: > Thanks!  However, isn't length(dev.list()) == 0 when there are no devices?  That's what I'm seeing on MacOS. Ifthere is only one graphics device then R should automatically set it as the active graphics device so it isn't really necessary to manu

Re: [Rd] Problems caused by dev.off() behaviour

2023-10-02 Thread Trevor Davis
> Thanks! However, isn't length(dev.list()) == 0 when there are no devices? That's what I'm seeing on MacOS. If there is only one graphics device then R should automatically set it as the active graphics device so it isn't really necessary to manually set it. Although there wouldn't be any harm

Re: [Rd] Problems caused by dev.off() behaviour

2023-10-02 Thread Duncan Murdoch
Thanks! However, isn't length(dev.list()) == 0 when there are no devices? That's what I'm seeing on MacOS. Duncan Murdoch On 02/10/2023 4:21 p.m., Trevor Davis wrote: > Use it just like dev.off(), but it *will* restore the previous device. I'm observing that if there were no previously ope

Re: [Rd] Problems caused by dev.off() behaviour

2023-10-02 Thread Trevor Davis
> Use it just like dev.off(), but it *will* restore the previous device. I'm observing that if there were no previously open graphics devices then your `safe.dev.off()` opens up a new graphics device which may be an undesired side effect (because "surprisingly" `dev.set()` on the null graphics dev

[Rd] Problems caused by dev.off() behaviour

2023-10-02 Thread Duncan Murdoch
I found some weird behaviour and reported it as https://bugs.r-project.org/show_bug.cgi?id=18604 and https://github.com/yihui/knitr/issues/2297, but it turns out it was user error. The dev.off() function was behaving as documented, but it behaves in an unexpected (by me) way, and that caused t