Created
July 26, 2019 13:46
-
-
Save johnjosephhorton/20f80084cec5692d88be5f54fc85b085 to your computer and use it in GitHub Desktop.
Lazy way to get all the packges you use & then install them at once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all your R files & get just the package names, uniquely | |
find ../analysis/ -name *R -print0 | xargs -0 grep -h 'library*' | sed 's/library//g' | sed 's/#//g' | sed 's/ //g' | sort | uniq|\ | |
sed 's/(//g' | sed 's/)//g' > package_list.txt | |
# Install each package | |
cat package_list.txt | xargs -I {} Rscript -e 'install.packages("{}")' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment