Use citation() in R Markdown to automatically generate a bibliography of R packages

Okay, here is another attempt I've made. For now, this is purely done in LaTeX, but if this looks correct to you, it can be turned into a TeX template for R Markdown.

Using biblatex you can declare bibliographic categories and add entries to each category. In the end, you can print them separately as reference pages

Here is the TeX code:.

\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\addbibresource{/Users/Matt/Desktop/refs.bib}

\DeclareBibliographyCategory{R}
\addtocategory{R}{R-ggplot2}

\DeclareBibliographyCategory{domain}
\addtocategory{domain}{eddelbuettel2011rcpp}

\begin{document}

Here is a great sentence about plotting (\cite{R-ggplot2}), which also has some domain content (\cite{eddelbuettel2011rcpp}).

\section*{Domain References}
\printbibliography[category=domain,heading=none]

\section*{R References}
\printbibliography[category=R,heading=none]
\end{document}

I rendered this by running, in order:

pdflatex filename
biber filename
pdflatex filename

It produces this: filename.pdf (60.8 KB)