pmur002 / gridgraphics

Redraw base graphics as grid graphics
33 stars 8 forks source link

Relax R >= 3.6.0 restriction #13

Open colearendt opened 5 years ago

colearendt commented 5 years ago

We do automated / CI testing to be sure that gridGraphics installs successfully on shinyapps.io . However, some of these CI servers run older versions of R ( < 3.6.0).

The R >= 3.6.0 change breaks this CI process, since base R does not have a smart enough way to "install the latest version of a package that works for my R version." Instead, it fails with "gridGraphics is not available for this R version."

Is it possible to relax this R >= 3.6.0 restriction for the package so that it installs successfully for older versions of R? Perhaps some functions would be unusable, but I think that would be an ideal opportunity to say "this function requires R >= 3.6.0" instead of failing on the package install.

e.g.:

if (getRversion() < "3.6.0") stop("This function requires R >= 3.6.0")
pmur002 commented 5 years ago

Unfortunately, this dependency is critical to the emulation of the graphics::axis() function. In other words, any attempt to echo a 'graphics' plot that contains an axis would fail. It might be possible to bracket sections of the emulation code with ...

if (getRversion() < "3.6.0") 
    # do old, sometimes inaccurate approach
else 
    # do new, better approach

... but, given the number of places that would be required, that would be torturous and nasty and not nice to maintain going forward.

Is it an option to install the previous 'gridGraphics' version on the older R systems ?

I guess I am asking whether it's easier for you to make your CI set up horribly complicated versus me making 'gridGraphics' horribly complicated :)

pmur002 commented 5 years ago

Thinking about it a little bit more, another option for me would be to simply bracket the entire axis emulation code with ...

if (getRversion() < "3.6.0") 
    # old code
else 
    # new code

... though I would not look forward very much to testing that the old version does exactly what it used to do and the new version does exactly what is currently does.

This bracketing would also have to be done with the mtext() emulation.

colearendt commented 5 years ago

😂 Yes, this makes sense. I was worried that the code that needed to be bracketed would not be simple 😬

The other user who will encounter this is the user who is using an old version of R. They will need to use devtools::install_version("gridGraphics", "0.3-0") to get the last version that worked on anything < 3.6.0. I think that is the use case probably worth thinking most about, and then we can do what we need to do in CI - just a matter of whether forcing many users (most users, today?) into that hole is desirable. I admittedly don't know much about the gridGraphics user base 😄

I would love if install.packages() was smart enough to fall back to the archive and install the latest version that is compatible with the local version of R 😭

pmur002 commented 5 years ago

Ok. I have tested the bracketed-code approach and it seems to be working. If you want to try it out yourself, I have pushed to github. Just waiting on Windows-builder checks to complete and I will probably wait until Monday to submit to CRAN (I hate submitting on a Friday in case things go wrong and I only submitted version 0.4-0 a few weeks ago, so don't want to be too hard on the heels of that).

colearendt commented 5 years ago

Thanks @pmur002 !! I appreciate your time on this issue, and I'm sure others who are slow to update (like me) will thank you for working around the idiosyncrasies of R and bearing with us 😄

It looks to be installing correctly for me on R 3.4.3!

pmur002 commented 5 years ago

Thanks for confirming (that it works). Hopefully I will get this onto CRAN next week.

pmur002 commented 5 years ago

This has passed the gatekeepers and should be on CRAN in the next day or two.