Is is possible to find out what R packages are not being used in R shiny app?

I am working on a legacy shiny app passed on. I see the list of the packages mentioned and seems to be a long list. Is it possible to figure out which of the packages are not being used so that we don't have to load unnecessary packages?

You could be interested in this dev :package::

itdepends provides tools to assess usage, measure weights, visualize proportions and assist removal of dependencies.

See rstudio conf

3 Likes

I'm on mobile but here are a few pointers : you could crawl all the exported functions of the packages (there are some functions in devtools for parsing namespace files) and then search your code for every function.

here is a function that gets exported functions of a package I wrote a while ago https://github.com/s-fleck/testthis/blob/master/R/Test_coverage.R (get _pkg_functions)

searching the source code should be easy (list.files, readLines, grep). if you need some pointers here, look through the source of my (experimental) github package sifr

1 Like

Thank you @hoelk . Will go through the package.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.