
Create a BibTeX File from a BibEntry Object e Creates a Bibtex File from a BibEntry object for use with either BibTeX or BibLaTex.
Source:R/WriteBib.R
WriteBib.RdCreate a BibTeX File from a BibEntry Object e Creates a Bibtex File from a BibEntry object for use with either BibTeX or BibLaTex.
Usage
WriteBib(
bib,
file = "references.bib",
biblatex = TRUE,
append = FALSE,
verbose = TRUE,
...
)Arguments
- bib
a BibEntry object to be written to file
- file
character string naming a file, should; end in “.bib”. Can be
NULL, in which case the BibEntry object will be written tostdout.- biblatex
boolean; if
TRUE,toBiblatexis used and no conversions of the BibEntry object are done; ifFALSEentries will be converted as described intoBibtex.BibEntry.- append
as in
write.bibin packagebibtex- verbose
as in
write.bibin packagebibtex- ...
additional arguments passed to
writeLines
Note
To write the contents of bib “as is”, the argument
biblatex should be TRUE, otherwise
conversion is done as in toBibtex.BibEntry.
See also
write.bib in package bibtex, ReadBib,
toBibtex.BibEntry, toBiblatex,
BibEntry
Examples
if (requireNamespace("bibtex")){
bib <- BibEntry("Article", key = "Carroll_2012",
doi = "10.1080/01621459.2012.699793",
year = "2012", month = "sep",
volume = 107, number = 499,
pages = {1166--1177},
author = "R. Carroll and A. Delaigle and P. Hall",
title = "Deconvolution When Classifying Noisy Data ...",
journal = "Journal of the American Statistical Association")
## Write bib if no server error and bibtex available
if (length(bib)){
tfile <- tempfile(fileext = ".bib")
WriteBib(bib, tfile, biblatex = TRUE)
identical(ReadBib(tfile), bib)
unlink(tfile)
}
}
#> Writing 1 Bibtex entries ...
#> OK
#> Results written to file ‘/tmp/RtmpYyxOcm/file5bd484aa320.bib’