I'm trying to use rentrez package to retrieve NIH files, and ran the following code (I followed what was on the rentrez tutorial):

pubmed_search <- entrez_search(db = "pubmed", 
                    term = "Case Reports[Filter] AND cardiovascular disease AND English[lang] AND 2009:2019[PDat])", 
                    retmax = 792711, 
                    use_history = TRUE)

for(i in seq(1,10000,100)){   
    recs <- entrez_summary(db="pubmed", 
                           retstart=i)   cat(    
seq_start+99, "sequences downloaded\r") }

However, instead of the 10,000 texts I expected, I only downloaded 100 files. Could so

  • 1
    $\begingroup$ Welcome to Bioinformatics.SE! It looks like you posted the question before you were done typing. No worries, just use the edit button to update it. Also, please indent code with 4 spaces or wrap it in triple backticks (```) so that it displays in a legible way. $\endgroup$ Jul 17, 2019 at 19:11
  • $\begingroup$ Also, include an API code in your Pubmed search script to increase the query limit. $\endgroup$
    – arup
    Aug 19, 2019 at 7:10

1 Answer 1


I don't program in R, but replace the last line of you code with the following and I suspect you will find it works,

for(i in seq(1,10000,1)){ recs <- entrez_summary(db="pubmed", web_history=pubmed_search$web_history, retmax=100, retstart=i) cat(seq_start+99, "sequences downloaded\r") }

Rationale I would guess seq is similar to the linspace function in Python, and put simply 10000 (total sample size) / 100 (the step size) = 100, 100 being the number of downloads you observed. In the code above its 10000/1. I would also suspect "step size = 1" is default, if this was correct then seq(1,10000) would give you your required output.

As a random aside I do like the presence of curly brackets defining the loop, it reminds me of Perl.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.