In Mendeley, the closest category for an R package appears to be "Computer Program"; however, R itself is a computer program, not its packages.

Other literature sources seem to cite technical documents about R packages instead of the actual packages.

Aside from manually entering the citations, is there a way to incorporate R packages in my Mendeley library?


Each R package has a different way to be cited. Some were formally published as scientific articles in journals, some only as packages. The only way to know for sure is to check how the package maintainer want you to cite their package, with function citation. Base R also comes with function toBibtex that help you export the correct citations as a bibtex file.

For instance:

> citation("Rcpp")

To cite Rcpp in publications use:

  Dirk Eddelbuettel and Romain Francois (2011). Rcpp: Seamless
  R and C++ Integration. Journal of Statistical Software,
  40(8), 1-18. URL http://www.jstatsoft.org/v40/i08/.

  Eddelbuettel, Dirk (2013) Seamless R and C++ Integration with
  Rcpp. Springer, New York. ISBN 978-1-4614-6867-7.

  Dirk Eddelbuettel and James Joseph Balamuta (2017). Extending
  R with C++: A Brief Introduction to Rcpp. PeerJ Preprints
  5:e3188v1. URL

To see these entries in BibTeX format, use 'print(<citation>,
bibtex=TRUE)', 'toBibtex(.)', or set

> toBibtex(citation("knitr"))
  title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
  author = {Yihui Xie},
  year = {2018},
  note = {R package version 1.20},
  url = {https://yihui.name/knitr/},

  title = {Dynamic Documents with {R} and knitr},
  author = {Yihui Xie},
  publisher = {Chapman and Hall/CRC},
  address = {Boca Raton, Florida},
  year = {2015},
  edition = {2nd},
  note = {ISBN 978-1498716963},
  url = {https://yihui.name/knitr/},

  booktitle = {Implementing Reproducible Computational Research},
  editor = {Victoria Stodden and Friedrich Leisch and Roger D. Peng},
  title = {knitr: A Comprehensive Tool for Reproducible Research in {R}},
  author = {Yihui Xie},
  publisher = {Chapman and Hall/CRC},
  year = {2014},
  note = {ISBN 978-1466561595},
  url = {http://www.crcpress.com/product/isbn/9781466561595},

As for importing bibtex files into Mendeley, I do not use Mendeley myself but this Q&A on TeX.se shows that one can simply use menu items "File > Import... > Bibtex (*.bib) " to do so.

  • This is only a first step, to answer the question it would be helpful to explain how you get the output of the function into mendeley. – Leo May 11 '18 at 9:39
  • 1
    Yet another source for Bibtex entries which fails to escape titles correctly. :( – Federico Poloni May 11 '18 at 13:06

You could export the citation as a bibtex file, e.g. https://www.rforge.net/doc/packages/knitr/write_bib.html


For example, if I want to cite Data in Function reference http://ggplot2.tidyverse.org/reference/#section-data, in this case, I will use web page to added to Mendeley manually as follow:

  • I think that this is the wrong answer. – Stella Biderman Mar 14 '18 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.