cv/R/functions.R
2024-03-13 15:33:20 +01:00

17 lines
635 B
R

orcid_pubs <- function(orcid, path="bib-files/publications.bib"){
dois <- Reduce(c,lapply(orcid,function(o){
works <- rorcid::orcid_works(orcid)[[1]]
Reduce(c, do.call(
cbind,
lapply(works$works$`external-ids.external-id`, function(a) {
if ("doi" %in% c(a[[1]])) {
s <- do.call(cbind, a)
s[, "external-id-normalized.value"][s[, "external-id-type"] == "doi"]
# Using the normalized values, a check has been run for bad DOIs
}
})
)) |> na.omit() |> unique()
}))
RefManageR::GetBibEntryWithDOI(dois) |> rbibutils::writeBib(path)}