if (FALSE) {
## Read in API key
ak <- readLines("api_key.txt")
## Example publications and their corresponding PMID's (some valid
## and some not)
pubs <- tibble::tribble(
~pmid,
"29559429",
"28837722",
NA,
"borp",
"98472657638729"
)
## Download Pubmed metadata
pm_meta <- get_metadata_from_pmids(pubs, "pmid", ak)
## Extract DOI's for those that were successfully downloaded
pm_meta %>%
dplyr::filter(pubmed_dl_success)
dplyr::select(pmid, doi)
## A tibble: 2 × 2
## pmid doi
##
## 1 29559429 10.1136/bmj.k959
## 2 28837722 10.1001/jama.2017.11502
}
Run the code above in your browser using DataLab