title: Harvest (rvest) multiple HTML pages from a list of urls
body: <p>I have a dataframe that looks like this:</p>
  
  <pre><code>country &lt;- c("Canada", "US", "Japan", "China")
  url &lt;- c("http://en.wikipedia.org/wiki/United_States", "http://en.wikipedia.org/wiki/Canada",
            "http://en.wikipedia.org/wiki/Japan", "http://en.wikipedia.org/wiki/China")
  df &lt;- data.frame(country, url)
  
      country link
  1   Canada  http://en.wikipedia.org/wiki/United_States
  2   US      http://en.wikipedia.org/wiki/Canada
  3   Japan   http://en.wikipedia.org/wiki/Japan
  4   China   http://en.wikipedia.org/wiki/China
  </code></pre>
  
  <p>Using <code>rvest</code> I'd like to scrape the <em>table of contents</em> for each url and bind them to one single output.</p>
  
  <p>This code extracts the table of contents for one url: </p>
  
  <pre><code>library(rvest)
  toc &lt;- html(url) %&gt;%
    html_nodes(".toctext") %&gt;%
    html_text()
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>country toc
  US      Etymology
          History
          Native American and European contact
          Settlements
          ...  
  Canada  Etymology
          History
          Aboriginal peoples
          European colonization
          ...etc
  </code></pre>