Skip to contents

Parse standard BibTeX (.bib) files into an sm_corpus object. Extracts entry type, title, author, year, DOI, journal, abstract, volume, pages, and keywords from each @type{key, ...} entry.

Usage

sm_read_bib(
  path,
  encoding = "UTF-8",
  engine = c("native", "bibliometrix", "auto"),
  verbose = TRUE,
  call = rlang::caller_env()
)

Arguments

path

Character scalar. Path to a .bib file.

encoding

Character scalar. File encoding (default "UTF-8").

engine

Character scalar. One of "native" (built-in parser), "bibliometrix" (delegate to bibliometrix::convert2df()), or "auto" (try bibliometrix first, fall back to native).

verbose

Logical. Print progress messages?

call

Caller environment for error reporting.

Value

An sm_corpus object.

Implementation

The native parser follows the BibTeX format specification as described in the original BibTeX documentation (Patashnik, 1988). Field values may be enclosed in braces or double-quotes and may span multiple lines. String concatenation with # is not supported; @string and @preamble entries are skipped.

References

Aria, M. & Cuccurullo, C. (2017). bibliometrix: An R-tool for comprehensive science mapping analysis. Journal of Informetrics, 11(4), 959–975. doi:10.1016/j.joi.2017.08.007

Examples

if (FALSE) { # \dontrun{
corpus <- sm_read_bib("references.bib")
corpus$works
} # }