Which can take a list of DOIs to cite parenthetically. The citet and citep functions are automatically retrieving the available metadata via the Crossref API, and R is storing the information to generate the final bibliography.
Using and creating citation keys
When specifying a DOI for a citation, we can also give the citation a simple key name so we can use it later without having to remember the DOI, for instance, we can make the first citation of a particular example as
If we do not pass a key for the DOI we create, knitcitations will automatically generate a key of it's own using the last name of the first author and the year. For instance, based on one of the DOI-citations we have already created, we can do
citet("Halpern2006")
[1] "Halpern et. al. (2006)"
and knitcitations recognizes the key. The function will try to avoid collisions in the key: if it is given or creates a key matching one that is already in use, it will see if the titles of the articles match. If the are the same, the same key is used to avoid a duplicate entry. This makes it safe to call
even if we have earlier or later cited by the doi alone. Collsion checking also avoids duplicating keys that correspond to different papers. If the titles are unique, knitcitations appends an underscore at the end of the automatically generated key. For instance, here we call a DOI that corresponds to a different citation with the same first author and year:
citet("10.1111/j.1523-1739.2005.00258.x")
Warning message: Automatic key generation found a copy of this key, using Halpern2006_ instead
[1] "Halpern et. al. (2006)"
A warning (not printed by knitr when this is used inline, but included in the log file) alerts us to the fact that this citation has been given an alternate key,
citet("Halpern2006_")
[1] "Halpern et. al. (2006)"
Of course if managing different keys sounds annoying, we can just call the DOI directly each time.
Done. All items, whether DOI or bibentry, get a bibkey generated automatically. A manual can be specified as the name to the object being passed in.
[1] "(Halpern et. al. 2006; Abrams et. al. 2012)"
Which can take a list of DOIs to cite parenthetically. The
citet
andcitep
functions are automatically retrieving the available metadata via the Crossref API, and R is storing the information to generate the final bibliography.Using and creating citation keys
When specifying a DOI for a citation, we can also give the citation a simple key name so we can use it later without having to remember the DOI, for instance, we can make the first citation of a particular example as
[1] "(Michaels & Tyre, 2012)"
and then later use
[1] "(Michaels & Tyre, 2012)"
If we do not pass a key for the DOI we create, knitcitations will automatically generate a key of it's own using the last name of the first author and the year. For instance, based on one of the DOI-citations we have already created, we can do
[1] "Halpern et. al. (2006)"
and knitcitations recognizes the key. The function will try to avoid collisions in the key: if it is given or creates a key matching one that is already in use, it will see if the titles of the articles match. If the are the same, the same key is used to avoid a duplicate entry. This makes it safe to call
[1] "Halpern et. al. (2006)"
even if we have earlier or later cited by the doi alone. Collsion checking also avoids duplicating keys that correspond to different papers. If the titles are unique, knitcitations appends an underscore at the end of the automatically generated key. For instance, here we call a DOI that corresponds to a different citation with the same first author and year:
[1] "Halpern et. al. (2006)"
A warning (not printed by knitr when this is used inline, but included in the log file) alerts us to the fact that this citation has been given an alternate key,
[1] "Halpern et. al. (2006)"
Of course if managing different keys sounds annoying, we can just call the DOI directly each time.