1

I would like to cite R packages we did for a group work, without direct citation, in my beamer presentation: I would like to have a final frame (or group of frames) that recap all the packages used. R exports the correct citations in Bibtex format so I would like to know how do this.

Thanks

3

Assuming that you know how compile a .Rnw file with knitr and biblatex, just compliging this file all the references of non-base attached packages in the R session are stored automatically in a .bib file and then you can use as usual with BibTex, or as in this example, with biblatex and biber:

mwe

\documentclass{beamer}
\usepackage{biblatex}
\addbibresource{test.bib}
\begin{document}
<<echo=F,message=F>>=
# R packages loaded only to test their references
library(xtable)
library(stargazer)
library(ggplot2)
library(pscl)
write_bib(names(sessionInfo()$otherPkgs),file="test.bib")
@
\begin{frame}[t,allowframebreaks]{References}
\nocite{*}
\printbibliography
\end{frame}   
\end{document}
  • Thanks Fran, however if I use this code (of course changing the .bib file) it gives me only 3 packages, that I did not use... – Luca Canepa Apr 16 '18 at 7:57
  • EDIT: no I figured out my mates did not export it in .rnw... we still need to work on it – Luca Canepa Apr 16 '18 at 8:17
  • 1
    @LucaCapena. Sure that you have all these packages installed? You have modified something in my example? Your R is updated? Without see the real code and the real output is a guessing game. Edit your question to show both the output and the code that you have used, except if it is just exactly the code of my answer). – Fran Apr 16 '18 at 10:23

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.