Skip to content

Instantly share code, notes, and snippets.

@pkiraly
Last active October 5, 2017 13:30
Show Gist options
  • Save pkiraly/8d042e7053f8083ca6aad031f4a40df3 to your computer and use it in GitHub Desktop.
Save pkiraly/8d042e7053f8083ca6aad031f4a40df3 to your computer and use it in GitHub Desktop.
original:
myPMCID <- function(x) {
if (x == "None") {
PMCID <- "None"
} else {
taxize_summ <- entrez_summary(db="pubmed", id=x)
PMC <- data.frame(taxize_summ$articleids)
PMC_ID <- grep("pmc-id:", PMC$value, value=TRUE)
if (identical(PMC_ID, character(0))) {
PMCID <- "None"
} else {
PMCID <- PMC_ID
}
}
return(PMCID)
}
suggestion:
myPMCID <- function(x) {
if (x == "None") {
PMCID <- "None"
} else {
taxize_summ <- entrez_summary(db="pubmed", id=x)
PMC <- data.frame(taxize_summ$articleids)
PMC_ID <- grep("pmc-id:", PMC$value, value=TRUE)
if (identical(PMC_ID, character(0))) {
PMCID <- "None"
} else {
PMCID <- PMC_ID
}
}
return(PMCID)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment