Skip to content
forked from Pakillo/grateful

Facilitate citation of R packages

License

Notifications You must be signed in to change notification settings

rccline/grateful

 
 

Repository files navigation

grateful

R-CMD-check

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")

About

Facilitate citation of R packages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%