Search code examples
rdatabaseimportconvertersbibtex

How to open PubMed's .nbib files


I'm struggling to open a .nbib file extracted from ERIC (MEDLINE/PubMed-style format). The file can be exported here. I'm trying to use the rbibutils package, but I'm struggling with that. Can anybody help me?

  • Code:
### LOAD PACKAGES

library(tidyverse)
library(rbibutils)

### READ DATA

bib_data <- readBib(file = "data/screening/fridayTest.nbib", 
                    encoding = 'UTF-8',
                    texChars = "convert",
                    informat = "nbib")

## filename: fridayTest.nbib
  • ERROR:
Error in readBib(file = "data/screening/fridayTest.nbib", encoding = "UTF-8",  : 
  length(list(...)) == 0 is not TRUE
  • I'm open to using other packages as well, I just need to open this file. Ultimately, I want to convert the file to a tibble or a dataframe. Any help will be much appreciated.

Solution

  • You can use revtools::read_bibliography() to get a data frame of all exported bibliographies. I downloaded the first 10 citations from your link, and just pointed the function to the file path of the .nbib file:

    cites <- revtools::read_bibliography("~/Downloads/ERIC2023-08-25_09.42.28.nbib")
    

    Output of cites (put as picture since so much texts makes it hard to paste here)

    enter image description here