title: Speeding up web search in a for loop?
body: <p>I have a list of 5500 latin names for species that I want to find the common names for. To do this I am running a loop which searches wikipedia for the latin name and then scrapes the common name from the resulting web page.</p>
  
  <p>Heres the code:</p>
  
  <pre><code>names &lt;- vector()
  for (i in binomial){
    session &lt;- html_session('https://www.wikipedia.org/')
    form &lt;- html_form(session)[[1]] %&gt;%
      set_values(search = i)
    submitted &lt;- submit_form(session, form)
    name &lt;- submitted %&gt;%
      html_nodes(xpath = '//*[@id="firstHeading"]') %&gt;%
      html_text()
    names &lt;- append(names, name)
  }
  </code></pre>
  
  <p>Where binomial is the list of latin names.</p>
  
  <p>This is a very time consuming process is there any way to optimise this code to speed it up?</p>