2

I have just discovered a package for R to retrieve abstract from pubmed, which is wonderful. But I keep receive an warning message during data retrieval:

R2009 <- pubmed.search("R+package[tiab]+AND+2009/01/01[dp]:2009/12/31[dp]",dest="temp",format="ris")
Warning message:
In download.file(e.query, dest = temp, quiet = TRUE) :
  downloaded length 2565 != reported length 200

> nrow(as.data.frame(R2009))
[1] 82

I have manually do a search in pubmed, and found the same number of article (82).

I wonder what the warning message means, anything needs to be fixed here? Thanks.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
lokheart
  • 23,743
  • 39
  • 98
  • 169
  • 2
    I can't reproduce your error (R 2.13.1, Ubuntu x86_64, RISmed_1.2.3). Knowing your operating system, R version, etc. would be helpful. Please provide the output of `sessionInfo()` – rcs Aug 08 '11 at 08:23
  • Note that it is a **warning** and not an error. I can't reproduce either on Linux (same R and RISmed versions). – Gavin Simpson Aug 08 '11 at 08:42
  • Works for me ... network connection problem? – Ben Bolker Aug 08 '11 at 13:09

2 Answers2

4

It means that whatever file pubmed.search() downloaded, it was of length 2565 (bytes I presume?) but the length reported during connection negotiations was just 200 bytes.

I don't know pub med that well, but one could well imagine a situation where the data file that contains the search results being downloaded is generated on the fly and the final file size is not known, so a dummy size is reported first but the actual download stream grows beyond this size. You can visually see this when using a browser from time to time - sometimes the browser doesn't know how big the download is so doesn't report a time to completion, just the amount of data downloaded.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
2

The 200 is the HTTP status value for OK, not the downloaded file length. The nuisance warning reveals an issue with the download.file function and depends on the method it uses internally to perform the download request.

mrb
  • 21
  • 1