Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing unused libraries in R

Tags:

r

code-cleanup

So I just finished up writing my first script to assemble a Weibull Analysis from a text file. In all of my tinkering I suspect I may have loaded some libraries that aren't used in the final script. Is there a quick way to check which libraries are being used by the script without checking each function?

like image 358
Brian Riggs Avatar asked Feb 05 '15 15:02

Brian Riggs


1 Answers

If you attach libraries via library or require it's easiest to search your code for those. If you call libraries without attaching them via <library>::<export> syntax then search for ::. If you're worried about transitive dependencies or just generally would like to create a reproducible environment look at the packrat package: http://rstudio.github.io/packrat/

like image 91
Lev Kuznetsov Avatar answered Sep 30 '22 22:09

Lev Kuznetsov