Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way in R to detect how often a package is used?

Tags:

r

Recently, I found that there are many packages that I don't use much, and some of them may never be used again. I would like to delete these packages, but I am worrying that some packages that I often use may depend on these rarely used ones.

So I am wondering whether there is a way in R to detect how often a package is used?

Thank you!

like image 534
sssssxk Avatar asked Dec 12 '19 03:12

sssssxk


1 Answers

I have never seen a package able to quantify the use of R packages.
Further, I see a risk in simply remove package, as there can be dependencies you are not aware of.

However, there is the package miniCRAN, which can show you dependencies between packages. So my suggestion would be that you scan for all your packages installed on your system and look for dependencies. In that way you could find packages which can be removed without breaking other packages even if you are using the functionality on a very rare basis.

One more recommendation is to not use system wide installed packages, but use packages dedicated to your projects. There are multiple tools which can be used in this context: renv, packrat. The goal of such approaches is to get a independent package libraries for each project. If the project is no longer in your focus you can easily remove the packages without touching the functionality of other projects,

like image 84
thomas Avatar answered Sep 28 '22 09:09

thomas