Data Science Desktop Survival Guide
by Graham Williams |
|||||
Adding Bibliographies |
Raw knitr supports the automatic generation of a bibliography for the packages attached into R. We can take advantage of this by specifying a LaTeX bibliography package like natbib. I prefer the (author, year) style and so I include the following in the preamble of my LaTeX documents.
\usepackage[authoryear]{natbib} |
If we attach the rattle package, we might like to cite it with the following LaTeX command:
\citep{R-rattle} |
This will produce a citation like (Williams, 2020). The “p” in
\citep
places the parentheses around the citation, without
which we get Williams (2020).
Then we can ask knitr to generate bibliographic entries for each attached package: