<p>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,</p>

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

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

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

CC BY-SA 4.0
2019-07-18T06:46:57.037Z
2019-07-18T06:55:32.317Z
2019-07-18T06:55:32.317Z
M__
<p>I'm trying to use rentrez package to retrieve NIH files, and ran the following code (I followed what was on the rentrez tutorial):</p>

<pre><code>pubmed_search &lt;- 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 &lt;- entrez_summary(db="pubmed", 
                           web_history=pubmed_search$web_history,
                           retmax=100, 
                           retstart=i)   cat(    
seq_start+99, "sequences downloaded\r") }
</code></pre>

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

CC BY-SA 4.0
2019-07-17T19:11:55.667Z
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.
Daniel Standage
CC BY-SA 4.0
2019-08-19T07:10:42.750Z
Also, include an API code in your Pubmed search script to increase the query limit.
arup
<r><entrez>
rentrez to retrieve NIH files
# rentrez to retrieve NIH files

(Asked by: username_0 on 2019-07-17)

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", 
                           web_history=pubmed_search$web_history,
                           retmax=100, 
                           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

**Tags:** r, entrez
> **Comments:**
> **username_1**: 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.  
> **username_2**: Also, include an API code in your Pubmed search script to increase the query limit.  

---

## 1 answers

### Answer by username_3 on 2019-07-18. Score: 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.


---

