This function reads a BibTex file and extracts the DOI of references (if originally present in the file).
fp_doi_from_bibtex(bibtex)
A character
vector with extracted DOI. Some values can be NA
in case of
books, chapters, etc. or if references are malformed.
# Path to the BibTeX provided by <fairpub> ----
filename <- system.file(
file.path("extdata", "references.bib"),
package = "fairpub"
)
# Extract DOI from BibTeX ----
fp_doi_from_bibtex(filename)
#> [1] "10.1098/rsos.160384" NA
#> [3] "10.1126/science.1212540" "10.9745/ghsp-d-21-00145"
#> [5] "10.1126/science.adk9900" "10.1016/j.ecolecon.2021.107082"
#> [7] "10.1177/014107680609900316" "10.1093/reseval/rvad012"
#> [9] "10.1111/ele.14395" "10.3998/ptpbio.3363"
#> [11] "10.4000/proceedings.elpub.2018.30" "10.1093/scipol/scs093"
#> [13] NA "10.1002/leap.1102"
#> [15] "10.1087/0953151053584975" NA
#> [17] "10.1177/0263395719858571" "10.1017/s1062798709000532"
#> [19] "10.1371/journal.pone.0127502" "10.1162/qss_c_00305"
#> [21] "10.1007/978-3-030-02511-3_1" NA
#> [23] "10.1371/journal.pbio.1002264" "10.3389/frma.2016.00007"
#> [25] "10.48550/arxiv.2407.16551" NA
#> [27] "10.1080/08109028.2014.891710" "10.1007/s11192-022-04586-1"
#> [29] "10.1098/rspb.2019.2047" "10.5281/zenodo.4558704"
#> [31] "10.1162/qss_a_00272" "10.3917/inno.063.0095"
#> [33] "10.1371/journal.pone.0243664" "10.1257/jep.15.4.183"
#> [35] "10.1073/pnas.0305628101" "10.1016/j.amjmed.2019.07.028"
#> [37] "10.32614/rj-2023-089" "10.5534/wjmh.230001"