ropensci / bib2df

Parse a BibTeX file to a tibble
https://docs.ropensci.org/bib2df
99 stars 22 forks source link

Error when reading bib file with one reference #20

Closed gorkang closed 6 years ago

gorkang commented 6 years ago

When reading a bib file with a single reference, bib2df gives the error:

Error in x[, 1] : incorrect number of dimensions

I downloaded the file you share in the vignette: LiteratureOnCommonKnowledgeInGameTheory and erased all but the first reference.

As you will see, bib2df works fine with the complete file but fails with the single-reference file. I had the same problem with other .bib files created using rcrossref::cr_cn().

bib2df::bib2df("bib2df.bib") # Works
bib2df::bib2df("bib2df_single.bib") # Error in x[, 1] : incorrect number of dimensions

I attach both files: bib2df.zip

Thanks!

pegeler commented 6 years ago

Hello @gorkang,

I have tried both files with a build of the project based on the latest commit and could not reproduce the error.

> bib2df("bib2df_single.bib")
# A tibble: 1 x 26
  CATEGORY BIBTEXKEY ADDRESS ANNOTE AUTHOR    BOOKTITLE CHAPTER CROSSREF EDITION EDITOR   HOWPUBLISHED
  <chr>    <chr>     <chr>   <chr>  <list>    <chr>     <chr>   <chr>    <chr>   <list>   <chr>       
1 ARTICLE  Arrow1986 NA      NA     <chr [1]> NA        NA      NA       NA      <chr [1… NA          
# ... with 15 more variables: 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>

I noticed this problem too back in January. I submitted PR #18 to correct it, which was merged on 6 Jan. Please check your install of bib2df to make sure it was built off SHA 4909e7b52da57955443a1e3c546ab9f5be2af9a1 or later.

If it is still giving you issues, let me know and I will take another crack at it. Otherwise, I recommend closing this issue.

Thanks!!!

gorkang commented 6 years ago

I updated to the last github version and it does work. Thanks for the help!