Download record type from DOIs with Rcrossref

63 Views Asked by At

I hava a set of DOIs and would like to download a vector with the publication types per DOI (e.g. Journal article, book, monograph,...) with help of the crossref api and the rcrossref package.

I tried following, but that doesn't work:

library("rcrossref")
cr_types(doi = "10.1109/TASC.2010.2088091")

A result I only get a metadata list, but not the record type of this publication. When I tried the same for the abstract of a publication, it worked:

cr_abstract(doi = "10.1109/TASC.2010.2088091")

Has someone an idea? Best regards, Richard

1

There are 1 best solutions below

0
knb On

I think you can do it like this.

get_bibtype <- function(doi) {
  tmpfile <- rcrossref::cr_cn(doi, raw = TRUE)
  writeLines(tmpfile, "tmp.bib")
  bib_entries <- bibtex::read.bib("tmp.bib")
  bibtype <- bib_entries$bibtype
  return(list(doi = doi, bibtype = bibtype))
}

call it like this:

result <- get_bibtype("10.1109/TASC.2010.2088091")
$doi
[1] "10.1109/TASC.2010.2088091"

$bibtype
[1] "Article"

This function is a bit convoluted and slow, but considering that a publication list or a list of references contains typically a few 100 items max, it might get the job done with some polishing.

I don't know how robust the read.bib() function is. For inconsistently written entries it might fail to return a correct bibtype-