0

I'm trying to use the RISmed package to extract data from the PubMed scientific database. I have used the exact same procedure before, but now I can't get it to work. The example below is a toy example.

library(RISmed)

res <- EUtilsSummary("pinkeye", type="esearch", db="pubmed", datetype='pdat', mindate=2000, maxdate=2015, retmax=500)

Error in file(con, "r") : cannot open the connection

QueryCount(res)

Error in QueryCount(res) : object 'res' not found

The 'QueryCount(res)' is supposed to return the number of hits found using the query, but since it didn't find a connection, it didn't find any hits.

I have checked if R has an internet connection and it seems like it does ; my mac also doesn't seem to have any issues. Does anyone else get this error, too? Do you know how to solve it?

Help is greatly appreciated!

Community
  • 1
  • 1
  • Output of `traceback()` and `sessionInfo()` could shed more light on the cause of error – Silence Dogood Feb 03 '17 at 08:55
  • Here it works `res; [1] "pinkeye[All Fields] AND 2000[PDAT] : 2015[PDAT]"` – Roman Feb 03 '17 at 09:17
  • @Osssan traceback() gives the following: 3: file(con, "r") 2: readLines(url, warn = FALSE, encoding = encoding) at #7 1: EUtilsSummary("pinkeye", type = "esearch", db = "pubmed", datetype = "pdat", mindate = 2000, maxdate = 2015, retmax = 500) – Mignon Wuestman Feb 03 '17 at 10:25

2 Answers2

0

Updating the package and restarting R did the trick!

I tried updated the package several times before but forgot to restart R.

Thanks!

0

You could add one line like Sys.sleep(0.1) in your code to pause 0.1s before sending the next request of searching. It worked for me.