Learn R Programming

⚠️There's a newer version (1.1.1) of this package.Take me there.

bib2df - Parse a BibTeX file to a tibble

Everyone writing reports and articles with LaTeX has probably used BibTeX before. BibTeX is the de facto standard for reference management and grounds its functionality on a list of references stored in local text file. Depending on the reference type, several fields are necessary to define a reference properly. An exemplary BibTeX entry looks as follows:

@Article{Binmore2008,
  Title = {Do Conventions Need to Be Common Knowledge?},
  Author = {Binmore, Ken},
  Journal = {Topoi},
  Year = {2008},
  Number = {1},
  Pages = {17--27},
  Volume = {27}
}

Parse the BibTeX file to a tibble

The BibTeX format is not convenient for any kind of analysis or visualization. Many R applications require a data.frame (or tibble) and bib2df offers a straightforward framework to parse a BibTeX file to a tibble.

library(bib2df)
path <- system.file("extdata", "biblio.bib", package = "bib2df")
bib <- bib2df(path)
bib
#> # A tibble: 3 x 26
#>   CATEGORY  BIBTEXKEY  ADDRESS ANNOTE AUTHOR BOOKTITLE    CHAPTER CROSSREF
#>   <chr>     <chr>      <chr>   <chr>  <list> <chr>        <chr>   <chr>   
#> 1 ARTICLE   Binmore20… <NA>    <NA>   <chr … <NA>         <NA>    <NA>    
#> 2 BOOK      Osborne19… <NA>    <NA>   <chr … <NA>         <NA>    <NA>    
#> 3 INCOLLEC… Brandenbu… New Yo… <NA>   <chr … The Economi… 3       <NA>    
#> # ... with 18 more variables: EDITION <chr>, EDITOR <list>,
#> #   HOWPUBLISHED <chr>, INSTITUTION <chr>, JOURNAL <chr>, KEY <chr>,
#> #   MONTH <chr>, NOTE <chr>, NUMBER <chr>, ORGANIZATION <chr>,
#> #   PAGES <chr>, PUBLISHER <chr>, SCHOOL <chr>, SERIES <chr>, TITLE <chr>,
#> #   TYPE <chr>, VOLUME <chr>, YEAR <dbl>

The df2bib() function makes it possible to write this tibble back to disk, enabling programmatic manipulation of a .bib file.

Installation

The latest version of bib2df can be installed from GitHub using devtools::install_github():

devtools::install_github("ottlngr/bib2df")

Version 1.0.1 is now available on CRAN:

install.packages("bib2df")

Community Guidelines

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


Copy Link

Version

Install

install.packages('bib2df')

Monthly Downloads

1,188

Version

1.0.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Philipp Ottolinger

Last Published

May 23rd, 2019

Functions in bib2df (1.0.1)

df2bib

Export a BibTeX tibble to a .bib file
bib2df

Parse a BibTeX file to a tibble
bib2df-package

bib2df: Parse a BibTeX file to data.frame