[R] Analyzing Publications from Pubmed via XML

Armin Goralczyk agoralczyk at gmail.com
Mon Dec 17 21:38:19 CET 2007


On Dec 15, 2007 6:31 PM, David Winsemius <dwinsemius at comcast.net> wrote:

> > pm.srch<- function (){
>    srch.stem <-"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term="
>    query <-as.character(scan(file="",what="character"))
>    doc <-xmlTreeParse(paste(srch.stem,query,sep=""),isURL = TRUE,
>          useInternalNodes = TRUE)
>    sapply(c("//Id"), xpathApply, doc = doc, fun = xmlValue)
>      }
> > pm.srch()
> 1: "laryngeal neoplasms[mh]"
> 2:
> Read 1 item
>       //Id
>  [1,] "18042931"
>  [2,] "18038886"
>  [3,] "17978930"
>  [4,] "17974987"
>  [5,] "17972507"
>  [6,] "17970149"
>  [7,] "17967299"
>  [8,] "17962724"
>  [9,] "17954109"
> [10,] "17942038"
> [11,] "17940076"
> [12,] "17848290"
> [13,] "17848288"
> [14,] "17848287"
> [15,] "17848278"
> [16,] "17938330"
> [17,] "17938329"
> [18,] "17918311"
> [19,] "17910347"
> [20,] "17908862"
>
>

I tried the above function with simple search terms and it worked fine
for me (also more output thanks to Martin's post) but when I use
search terms attributed to certain fields, i.e. with [au] or [ta], I
get the following error message:

> pm.srch()
1: "laryngeal neoplasms[mh]"
2:
Read 1 item
Fehler in .Call("RS_XML_ParseTree", as.character(file), handlers,
as.logical(ignoreBlanks),  :
  error in creating parser for
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=laryngeal
neoplasms[mh]
I/O warning : failed to load external entity
"http%3A//eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb=pubmed&term=laryngeal%20neoplasms%5Bmh%5D"
>

What's wrong?
Thanks for any help
-- 
Armin Goralczyk, M.D.
--
Universitätsmedizin Göttingen
Abteilung Allgemein- und Viszeralchirurgie
Rudolf-Koch-Str. 40
39099 Göttingen
--
Dept. of General Surgery
University of Göttingen
Göttingen, Germany
--
http://www.chirurgie-goettingen.de


More information about the R-help mailing list