When running shiny apps in RStudio using runGitHub()
, I often found that the app would crash if required libraries couldn't be loaded. For complex apps, this was frustrating because it was difficult to know which libraries were required unless there's good documentation and/or code layout.
But this is a common problem when sharing code in general. So this little script was my own attempt at a solution.
Note: The pacman
package has a similar motivation. But as far as I can tell, it requires loading libraries with the p_load
function. So you could probably just recursively replace library
or require
calls with p_load
as an alternative to this solution.