Learn R Programming

⚠️There's a newer version (0.2.11) of this package.Take me there.

grateful

The goal of grateful is to make it very easy to cite the R packages used in any report or publication. By calling a single function, it will scan the project for R packages used, and generate a document with citations in the desired output format (Word, PDF, HTML, Markdown).

Importantly, these references can be formatted for a specific journal so that we can just paste them directly into the bibliography list of our manuscript or report.

If you prefer to get just a BibTeX file with all package citations, it can also be done (see examples below).

Installation

remotes::install_github("Pakillo/grateful")

Basic usage

Imagine a project where we are using the following packages: readr, dplyr, vegan, lme4, and ggplot2. Calling cite_packages will scan the project, find these packages, and generate a document with formatted citations.

library(grateful)
cite_packages()

This document can also be a Word document, PDF file, markdown file, or Rmarkdown file. And use the citation style of a particular journal:

cite_packages(style = "ecology", out.format = "docx")

You can also save the output of cite_packages to a specified directory.

# Save the output in Rmarkdown format only and to a docs folder.
cite_packages(out.format = "rmd", out.dir = file.path(getwd(), "docs"))

If you just want a BibTeX (.bib) file with all package citations:

get_citations(scan_packages())

Workflow

cite_packages is a wrapper function which internally performs the following steps:

1 Scan the project for packages

pkgs <- scan_packages()

2 Get citations for each package

cites <- get_citations(pkgs)

3 Create an rmarkdown document citing all these packages

rmd <- create_rmd(cites)

4 Rendering the rmarkdown document to the desired output format

render_citations(rmd, output = "html")

Copy Link

Version

Install

install.packages('grateful')

Monthly Downloads

588

Version

0.0.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Francisco Rodriguez-Sanchez

Last Published

March 14th, 2025

Functions in grateful (0.0.2)

grateful

grateful.
render_citations

Render package citations
get_csl

Get a journal citation style from internet repository
get_citations

Get citations for packages
cite_packages

Cite R packages used in a project
create_rmd

Create template rmarkdown file with package citations
scan_packages

Scan a project or folder for packages used