I wrote a somewhat clumsy function (credit_packages()) for doing what grateful::cite_packages() does, because I wanted it and I hadn't found this package yet. However, now I have :)! Hurray! 馃帀 I'm very impressed, I like this package a lot! It's been really fun exploring grateful::cite_packages() and seeing how many times we thought along the same lines, and also how you had just done things better.
Now that I've learned that grateful exists, I'd like to move on from my own "hand-made" and use the better function from this package. The two functions are pretty similar. I noticed a few differences though, and I was wondering if you'd consider adding a couple of functionalities to grateful::cite_packages()?
- Adjust cite_packages(output = "file", out.format = "tex-fragment") so that it additionally writes two separate .tex files: one containing a longtable/booktabs-style table of packages and versions, and one containing the citation keys as a string that can be included directly in a LaTeX document with \input{}.
1a) For the citation keys string in the tex-fragment output, the last item in the list should be joined with "and" rather than a comma
- further cleaning of bibTeX. I've found that some package developers write faulty bibTeX entries, especially when it comes to escaping ampersands. I can see you're doing some cleaning, but I'm not sure if you've got a fix for ampersands not being correctly escaped in titles? I just do some "clumsy" replacements, not pretty but has worked for what I've encountered so far:
bib <- bib |>
stringr::str_replace_all("\\&", "\\\\&") |> #sorting out issues with ampersand
stringr::str_replace_all("\\\\\\\\&", "\\\\&")
-
Warns about loaded but unused packages. This is technically the job of renv, but I figured it could be useful to do here too so I did a rudimentary check of this as well. Totally optional, just a suggestion.
-
very optional, but I've found it fun to report the top 5 most used functions and the top 5 R-files with the different functions
> output <- credit_packages(fns = fns, output_dir = "output/credit_packages/", print_LaTeX_table = TRUE, verbose = FALSE, report_most_used_pkgs = TRUE, report_script_with_most_funs = TRUE)
The top 5 packages you used the most:
packages n
[1,] "dplyr" "112"
[2,] "terra" " 39"
[3,] "ggplot2" " 37"
[4,] "plyr" " 34"
[5,] "raster" " 33"
The top 5 scripts which use the most functions:
script n
[1,] "./05_brms_plotting.R" "154"
[2,] "../utility/functions//credit_packages.R" "116"
[3,] "../utility/functions//fun_def_gp_cov_plot.R" "107"
[4,] "./04_brms.R" " 39"
[5,] "./00_global_parameters.R" " 4"
Again, really happy to have found this package! 馃帀馃帀馃帀
I wrote a somewhat clumsy function (credit_packages()) for doing what
grateful::cite_packages()does, because I wanted it and I hadn't found this package yet. However, now I have :)! Hurray! 馃帀 I'm very impressed, I like this package a lot! It's been really fun exploringgrateful::cite_packages()and seeing how many times we thought along the same lines, and also how you had just done things better.Now that I've learned that
gratefulexists, I'd like to move on from my own "hand-made" and use the better function from this package. The two functions are pretty similar. I noticed a few differences though, and I was wondering if you'd consider adding a couple of functionalities tograteful::cite_packages()?1a) For the citation keys string in the tex-fragment output, the last item in the list should be joined with "and" rather than a comma
Warns about loaded but unused packages. This is technically the job of
renv, but I figured it could be useful to do here too so I did a rudimentary check of this as well. Totally optional, just a suggestion.very optional, but I've found it fun to report the top 5 most used functions and the top 5 R-files with the different functions
Again, really happy to have found this package! 馃帀馃帀馃帀