bib2df
bib2df copied to clipboard
bib variables with '.' in name
Hi, thanks for the great package.
I have found an edge-case that causes an issue with writing valid .bib files with df2bib. Specifically, I had a .bib entry that had 2 DOI values, like the following:
@article{test2022, doi = {DOI_PLACEHOLDER}, doi = {DOI_PLACEHOLDER2} }
parsing this with bib2df, and then rewriting it with df2bib, then results in something like:
@article{test2022, doi = {DOI_PLACEHOLDER}, doi.1 = {DOI_PLACEHOLDER2} }
However, '.' is not a valid character for a variable name for .bib files (I think; at least had issues knitting a .rmd).
I suspect this would be an easy fix, where you could substitute '.' in variable names with '_' or something?
Cheers
I think this is caused by a tidyverse assumption when getting duplicate col names, reading through bib2df code now to see where this could be fixed.
On second though, I'm not sure this is really a bug. You shouldn't have duplicate fields in entries to start with, so the fact that something is breaking here may actually be a good thing as it alerts you to it.
You should be getting this warning:
Some BibTeX entries may have been dropped.
The result could be malformed.
Review the .bib file and make sure every single entry starts
with a '@'
What do you think @giabaio ?