R/ncbiPMC.R

Defines functions ncbiPMC

Documented in ncbiPMC

ncbiPMC <- function(term, ... )
{ 
   if(length(term) > 1){ term  <- paste(term, collapse = ",") }  
   # use efetch to get full text with retmode="xml"

   term <- gsub("PMC", "", term)
   # CHECK if IDs (and skip esearch)
   if( grepl("^[0-9,]*$", term)){
     x <- esummary(term, "pmc", version="2.0", parse=FALSE)
   }else{
     x <- esummary(esearch(term, "pmc"), version="2.0", parse=FALSE)
   } 
   ## Empty id list - nothing todo
   if(class(x)[1]=="character"){
      NULL
   }else{
      # authorsN=3, journalFull=TRUE 
      parse_pmc_XML(x, ...)
   }
}
cstubben/pmcXML documentation built on May 14, 2019, 12:25 p.m.