Created
April 9, 2017 18:21
-
-
Save briandk/3dbfcdaea2b2d0dea699a9febd830627 to your computer and use it in GitHub Desktop.
Wil Doane's system for automatically generating bibliography entries for the R packages you're using
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
# Early in the script | |
pkgs_pre_script <- try(devtools::loaded_packages(), silent = TRUE) | |
# Late in the script | |
pkgs_used_during_script <- try(devtools::loaded_packages(), silent = TRUE) | |
cat("* ") | |
print(citation(), style="text") # or Bibtex or LaTeX | |
if ((class(pkgs_pre_script) != "try-error") & | |
(class(pkgs_used_during_script) != "try-error")) { | |
for (pkg in dplyr::anti_join(pkgs_used_during_script, | |
pkgs_pre_script, | |
by = "package")$package) { | |
cat("* ") | |
print(citation(pkg), style="text") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment