Created
October 22, 2018 08:21
-
-
Save kevinrue/1d3bede1ec9c23ab8e2b6d8c70ca943b to your computer and use it in GitHub Desktop.
Identify the unique list of R packages loaded by "library" or "require" statements
This file contains hidden or 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
# The following command: | |
# - Parses (recursively) all files within the "R/" folder (Change as relevant). | |
# - Identifies all lines that include the statements "require(" or "library(". | |
# - Trims everything before and including "require(" or "library(", and everything after the next ")", leaving only the package name. | |
# - Identifies the unique list of packages loaded in those ways. | |
grep -Rn '.*\(require\|library\)(.*' R/* | sed 's/.*\(require\|library\)(\(.*\)).*/\2/g' | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment