title: How to use a loop in R within a dataframe to get the content of many URL's?
body: <p>I have created a data.frame that contains on its 5 column a list of news url's (1.000 pages). I would like to get the content of each news article/link. I have tried to use a loop within the dataframe to scrape the content of each link but as a result I just get the content of the last link. </p>
  
  <pre><code>    #Getting the dynamic URL using %d
  
      url_principal &lt;- 'https://www.eltiempo.com/buscar/%d? 
      q=proceso+de+paz&amp;publishedAt[from]=12-08-26&amp;publishedAt[until]=16-12- 
      03&amp;contentTypes[0]=article'
  
      #Reading through the pages and collecting website elements
  
      map_df(1:1000, function(i) {
  
     pagina &lt;- read_html(sprintf(url_principal, i, '%s', '%s', '%s', '%s'))
  
     data.frame(titulo = html_text(html_nodes(pagina, ".title.page-link")),
               lead = html_text(html_nodes(pagina, ".epigraph.page-link")),
               section = html_text(html_nodes(pagina, ".category")),
               date = html_text(html_nodes(pagina, ".published-at")),
               link = str_trim(html_attr(html_nodes(pagina, ".title.page-link"), "href")),
                        stringsAsFactors=FALSE)
    }) -&gt; noticias_completas
  
      #Adding https to the links
      news_complete_https &lt;- gsub("^","https://www.eltiempo.com", 
      noticias_completas[1:1000, 5])
      news_complete_https&lt;- data.frame(lapply(news_complete_https, 
      as.character), stringsAsFactors = FALSE)
  
      #Loop for getting the content of each link within the data frame
      for(i in noticias_completas_frame){
      text &lt;- read_html(i)
      contenido&lt;- text%&gt;% html_nodes(".articulo-contenido")%&gt;% html_text()%&gt;% 
     as.character()
      } -&gt; final
  </code></pre>
  
  <p>How should I do to get all the url's content and not just the last entry? What other options rather than loops I have to achieve this?</p>
  
  <p>Thanks a lot for the help!</p>