title: R - How to extract all items from a list located at a specific depth level based on names
body: <p>I got a xml_data list from a parsed xml document.</p>
  
  <pre><code>library(XML)
  library(httr)
  
  identifiant_du_document = "ark:/12148/bpt6k96718891"
  base_request = "https://gallica.bnf.fr/services/Toc?ark=" 
  api_request = paste0(base_request,identifiant_du_document)
  get_volume1 &lt;- GET(api_request)
  doc&lt;-xmlParse(get_volume1)
  xml_data &lt;- xmlToList(doc)
  </code></pre>
  
  <p>Let's say I want to retrieve all items located at the <em>head</em> balise. By this, I mean:</p>
  
  <pre><code>xml_data$text$body$div0[[3]]$head
  xml_data$text$body$div0[[4]]$head
  xml_data$text$body$div0[[5]]$head
  xml_data$text$body$div0[[6]]$head
  xml_data$text$body$div0[[7]]$head
  </code></pre>
  
  <p>and so on ....</p>