Title: | Parse a BibTeX File to a Data Frame |
---|---|
Description: | Parse a BibTeX file to a data.frame to make it accessible for further analysis and visualization. |
Authors: | Philipp Ottolinger [aut], Thomas Leeper [ctb], Maƫlle Salmon [ctb], Paul Egeler [ctb], Emilio Xavier Esposito [ctb], Gianluca Baio [ctb, cre] |
Maintainer: | Gianluca Baio <[email protected]> |
License: | GPL-3 |
Version: | 1.1.2.0 |
Built: | 2024-12-09 05:15:08 UTC |
Source: | https://github.com/ropensci/bib2df |
tibble
The BibTeX file is read, parsed, tidied and written to a tibble
bib2df(file, separate_names = FALSE, merge_lines = FALSE)
bib2df(file, separate_names = FALSE, merge_lines = FALSE)
file |
character, path or URL to a .bib file. |
separate_names |
logical, should authors' and editors' names be separated into first and given name? |
merge_lines |
logical, set to |
For simplicity bib2df()
unifies the reading, parsing and tidying of a BibTeX file while being aware of a standardized output format, different BibTeX styles and missing values in the BibTeX file.
When separate_names = TRUE
, the respective columns contain a data.frame
for each row. When FALSE
, the respective columns contain character strings.
A tibble
.
Philipp Ottolinger
# Read from .bib file: path <- system.file("extdata", "bib2df_testfile_3.bib", package = "bib2df") bib <- bib2df(path) str(bib) # Read from .bib file and separate authors' and editors' names: bib <- bib2df(path, separate_names = TRUE) str(bib)
# Read from .bib file: path <- system.file("extdata", "bib2df_testfile_3.bib", package = "bib2df") bib <- bib2df(path) str(bib) # Read from .bib file and separate authors' and editors' names: bib <- bib2df(path, separate_names = TRUE) str(bib)
tibble
to a .bib fileThe BibTeX tibble
is written to a .bib file
df2bib(x, file = "", append = FALSE, allfields = TRUE)
df2bib(x, file = "", append = FALSE, allfields = TRUE)
x |
|
file |
character, file path to write the .bib file. An empty character string writes to |
append |
logical, if |
allfields |
logical, if |
file
as a character string, invisibly.
Thomas J. Leeper
Gianluca Baio
https://www.bibtex.org/Format/
# Read from .bib file: path <- system.file("extdata", "bib2df_testfile_3.bib", package = "bib2df") bib <- bib2df(path) # Write to .bib file: # bibFile <- tempfile() # df2bib(bib, bibFile) # Use `append = TRUE` to add lines to an existing .bib file: # df2bib(bib, bibFile, append = TRUE)
# Read from .bib file: path <- system.file("extdata", "bib2df_testfile_3.bib", package = "bib2df") bib <- bib2df(path) # Write to .bib file: # bibFile <- tempfile() # df2bib(bib, bibFile) # Use `append = TRUE` to add lines to an existing .bib file: # df2bib(bib, bibFile, append = TRUE)