Suggested additions
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 242
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
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! 🎉🎉🎉
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the linked R/credit_packages.R implementation with grateful::cite_packages(), then inspect the current cite_packages() output and BibTeX-cleaning behavior. Separate the requested output, escaping, unused-package warning, and usage-report ideas, and confirm which subset is in scope before implementing and testing it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100