I always try to cite #rstats packages in my publications (and so should you). Sometimes it's easy because there's a publication directly associated with the package. But most of the time, it needs to be cited by itself. In this case, it would be great if the CRAN page of the package has a bibtex or ris file that can be easily loaded into citation software instead of manual entry. A good example is the great #ggpubr package: https://cran.r-project.org/web/packages/ggpubr/index.html
#ScienceMastodon #foss #opensource #rstat
ggpubr: 'ggplot2' Based Publication Ready Plots

The 'ggplot2' package is excellent and flexible for elegant data visualization in R. However the default generated plots requires some formatting before we can send them for publication. Furthermore, to customize a 'ggplot', the syntax is opaque and this raises the level of difficulty for researchers with no advanced R programming skills. 'ggpubr' provides some easy-to-use functions for creating and customizing 'ggplot2'- based publication ready plots.

Found a workaround on Twitter thanks to @gsapijaszko that solves this from within #rstats. If I want to produce a #bibtex file for #terra and #ggpubr, the code would be something like:
packages <- c("terra", "ggpubr")
knitr::write_bib(packages, file = "../../packages.bib")

@hakim heh, didn't know you are there :). Thanks for kind words, and I hope it helped.

To be honest, in long term, I would encourage you to try quarto as a writing/publishing system, instead of word :)

@hakim
I think citation() in R does this, though I don't use bibtex so not sure how well it works for that.
@vansickle Thanks Caroline, I found a solution using the knitr package, see the response below the original post.
@hakim How about: writeLines(toBibtex(citation("<package>")), "ref.bib")