Relax rsconnect's package version dependencies

I've written a shiny app that uses the data.table package. The app uses a number of lookup summary tables, which I generate locally before publishing. To generate these summary tables I prefer to use the development version of data.table (v 1.10.5) rather than the latest stable version (1.10.4.3), as the script takes about 5-10 minutes longer to run when using 1.10.4.3. The actual app doesn't make use of any dev features.

However, with v.1.10.5 installed, I can't publish to shinyapps.io (by clicking publish in the RStudio pane) as rsconnect::appDependencies complains that my version of data.table is not supported. This I understand -- I'm not suggesting shinyapps permit dev versions of packages; however, given I know that the CRAN version will be fine, how can I publish nonetheless, using the latest stable version? The help page for rsconnect::appDependencies provides help in the inverse case (when a package is actually required but rsconnect doesn't notice).

My current workaround is to uninstall data.table, then reinstall from CRAN, publish, then do the reverse. This isn't too bad, but seems unnecessary.

You could do that but install the CRAN data.table in another library (local to your project maybe) and add this library first in your .libPaths() before deploying.

rsconnect looks at your local setup to infer what version or package you are using. Doing that will insure that the data.table CRAN version will be found first.

So you won't have to install / desinstall each time. Just once, then switch library before deploying.

There are some helpful :package: that can also help you with that.

  • You can use a packrat on your project to insure that the data.table version for your specific project depends on CRAN version (but it sees you want to switch). Packrat will create local library with your dependencies and you can packrat::on() and packrat::off() to activate the local library or not
  • Use devtools::dev_mode() to activate a dev library. I do that when I work with dev version of package when I want to keep a cran version. The dev Version are in a library R-dev in my home and I activate this library with devtools::dev_mode().
  • To switch between libraries, you can also use the package switchr that can help.
1 Like