issues with dev.new avoiding RStudio plot device on unix?
On 09/26/2015 03:22 AM, Duncan Murdoch wrote:
On 26/09/2015 1:42 AM, Skye Bender-deMoll wrote:
Sorry, should have given more background. x11 works fine on all my systems when called by x11(). I'm the maintainer of a package that uses the animation library, which has performance issues when used with the RStudio plot device. But if you call plot.new() when using RStudio, you get an RStudio device, not the standard device for the platform because it overrides the device option. So I've had to have the library do platform detection and platform-specific device calls, which R CMD check doesn't like. I believe that noRStudioGD argument was avoided to give users a way around this, but it doesn't seem to be behaving correctly in the unix interactive case.
It seems like the best workaround here could come from RStudio. They could provide a way for a user to indicate that they sometimes don't want to use the RStudio graphics device (e.g. an option setting), and your package could set and restore this option around your dev.new() call.
That would make sense, I've tried to propose they add it as a feature in the rstudioapi. However, since the noRstudioGD option now exists in R, I'd think it should behave consistently across platforms? Opening pdf on one and interactive on another seems odd.
The other seems to be for your package to temporarily set R_DEFAULT_DEVICE if the user doesn't already have it set, and use noRStudioGD=TRUE. The disadvantage of this is that you need to do all the platform-based decision making.
Great idea, I'll employ this workaround for now. Thanks! best, -skye