I am using citation() to automatically get the bib entries for R packages. However, its output does not have a key.
Example:
utils:::print.bibentry(citation(), style = "Bibtex")
Output:
@Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2017},
url = {https://www.R-project.org/},
}
I would like something like this:
@Manual{mykey999,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2017},
url = {https://www.R-project.org/},
}
I've tried the same command with the "key" argument but it changes nothing:
utils:::print.bibentry(citation(), style = "Bibtex", key= "mykey0")
Any idea?
You can do
z = citation()
z$key = "Hullo"
print(z, "Bibtex")
which gives
@Manual{Hullo,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2017},
url = {https://www.R-project.org/},
}
Alternately, there's the silly one-liner:
print(`$<-`(citation(), key, "Hullo"), "Bibtex")
I guess using :::
to access print
(as in the OP) is overkill here. If you like looking at internals, though, maybe have a gander at utils:::`$<-.bibentry`
. From there, you can see that expected assignments are to...
utils:::bibentry_attribute_names
# [1] "bibtype" "textVersion" "header" "footer" "key"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With