Determining which version of R to depend on

I think I'm the cause of much of this confusion because for a while devtools::create_description() would automatically require the version of R that you called the function for. At the time, my thinking was that you should be conservative and only claim to support the versions that you've actually tested on (typically, only the version you're currently using). But in practice, that is not a good approach because versions of R don't differ by that much, and most packages will mostly work fine on older versions of R. Explicitly requiring a recent version prohibits people from using an older version, and the net effect is more pain.

Now, I think you should only explicitly require an R version under two circumstances:

  • You are required to by R CMD check

  • You have checked that your package works on multiple versions of R and you want to assert that. (This is now easy on travis)

Unfortunately, however, there's no way to test if your package works if a dependency has explicitly declared that it needs a more modern version - there's a major clash between the approach I previously advocated and the approach that I now advocate.

I think that means in most cases, if there is any doubt, you should simply omit the version specification. In the tidyverse we are taking a more aggressive approach (because we have more R package development time/resources available to us), slowly pushing the tested version of R back to 3.1 for all packages. This was a lot of work at first, because (e.g.) to get ggplot2 working on R 3.1 we needed to get every dependency also working, but now that we've fixed most of the infrastructure packages, testing with >=3.1 is now typically pretty easy for a new package.

6 Likes