Parse a bibentry
object to a valid format for a CITATION.cff
file.
Arguments
- bib
A
bibentry
object, either created withbibentry()
(preferred) orcitEntry()
.
Value
A cff
object ready to be used on cff_create()
.
Details
This is a helper function designed to help on adding or replacing the auto-generated authors of the package. See Examples.
This function tries to adapt a bibentry
object (generated with bibentry()
or citEntry()
) to the CFF standard.
Entry types considered
Article, Book, Booklet, InBook, InCollection, InProceedings, Manual, MastersThesis, Misc, PhDThesis, Proceedings, TechReport, Unpublished. See
bibentry()
for more information.
Note that Conference is not implemented in
bibentry()
, however is equivalent to InProceedings (Patashnik (1988)).
References
Patashnik, Oren. "BIBTEXTING" February 1988. https://osl.ugr.es/CTAN/biblio/bibtex/base/btxdoc.pdf.
Haines, R., & The Ruby Citation File Format Developers. (2021). Ruby CFF Library (Version 0.9.0) (Computer software). doi:10.5281/zenodo.1184077 .
See also
cff_create()
, vignette("bibtex_cff", "cffr")
, bibentry()
Other Parsers:
cff_parse_person()
Examples
# \donttest{
bib <- citation("base")
bib
#> To cite R in publications use:
#>
#> R Core Team (2023). _R: A Language and Environment for Statistical
#> Computing_. R Foundation for Statistical Computing, Vienna, Austria.
#> <https://www.R-project.org/>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {R: A Language and Environment for Statistical Computing},
#> author = {{R Core Team}},
#> organization = {R Foundation for Statistical Computing},
#> address = {Vienna, Austria},
#> year = {2023},
#> url = {https://www.R-project.org/},
#> }
#>
#> We have invested a lot of time and effort in creating R, please cite it
#> when using it for data analysis. See also ‘citation("pkgname")’ for
#> citing R packages.
# To cff
bib_to_cff <- cff_parse_citation(bib)
bib_to_cff
#> type: manual
#> title: 'R: A Language and Environment for Statistical Computing'
#> authors:
#> - name: R Core Team
#> location:
#> name: Vienna, Austria
#> year: '2023'
#> url: https://www.R-project.org/
#> institution:
#> name: R Foundation for Statistical Computing
# Create the object
new_cff <- cff()
full <- cff_create(new_cff, keys = list("preferred-citation" = bib_to_cff))
full
#> cff-version: 1.2.0
#> message: If you use this software, please cite it using these metadata.
#> title: My Research Software
#> authors:
#> - family-names: Doe
#> given-names: John
#> preferred-citation:
#> type: manual
#> title: 'R: A Language and Environment for Statistical Computing'
#> authors:
#> - name: R Core Team
#> location:
#> name: Vienna, Austria
#> year: '2023'
#> url: https://www.R-project.org/
#> institution:
#> name: R Foundation for Statistical Computing
# Validate
cff_validate(full)
#> ══ Validating cff ══════════════════════════════════════════════════════════════
#> ✔ Congratulations! This <cff> is valid
# Several citations
cff_parse_citation(citation("rmarkdown"))
#> - type: manual
#> title: 'rmarkdown: Dynamic Documents for R'
#> authors:
#> - family-names: Allaire
#> given-names: JJ
#> - family-names: Xie
#> given-names: Yihui
#> - family-names: Dervieux
#> given-names: Christophe
#> - family-names: McPherson
#> given-names: Jonathan
#> - family-names: Luraschi
#> given-names: Javier
#> - family-names: Ushey
#> given-names: Kevin
#> - family-names: Atkins
#> given-names: Aron
#> - family-names: Wickham
#> given-names: Hadley
#> - family-names: Cheng
#> given-names: Joe
#> - family-names: Chang
#> given-names: Winston
#> - family-names: Iannone
#> given-names: Richard
#> year: '2023'
#> notes: R package version 2.25
#> url: https://github.com/rstudio/rmarkdown
#> - type: book
#> title: 'R Markdown: The Definitive Guide'
#> authors:
#> - family-names: Xie
#> given-names: Yihui
#> - family-names: Allaire
#> given-names: J.J.
#> - family-names: Grolemund
#> given-names: Garrett
#> publisher:
#> name: Chapman and Hall/CRC
#> address: Boca Raton, Florida
#> year: '2018'
#> isbn: '9781138359338'
#> url: https://bookdown.org/yihui/rmarkdown
#> - type: book
#> title: R Markdown Cookbook
#> authors:
#> - family-names: Xie
#> given-names: Yihui
#> - family-names: Dervieux
#> given-names: Christophe
#> - family-names: Riederer
#> given-names: Emily
#> publisher:
#> name: Chapman and Hall/CRC
#> address: Boca Raton, Florida
#> year: '2020'
#> isbn: '9780367563837'
#> url: https://bookdown.org/yihui/rmarkdown-cookbook
# }