title: R: rvest library to extract nested node content
body: <p>This is a link to a journal page:<br >
  <a href="https://genomebiology.biomedcentral.com/articles/10.1186/s13059-018-1535-9" rel="nofollow noreferrer">https://genomebiology.biomedcentral.com/articles/10.1186/s13059-018-1535-9</a> <br >
  I'm trying to get the following: Author Affiliations (all authors), Corresponding Author, and Corresponding Author's Email. Note: it is assumed the corresponding author is the last author listed in the authors sections at the top of the article. I've used SelectorGadget to identify some tags for other elements like Abstract and Publication Date, but I just can't seem to figure out how to get these three. The following is my code to get the authors as a character vector:<br ></p>
  <pre><code>#url is the url for the list of articles on a particular page
  s &lt;- html_session(url)&lt;br &gt;
  page &lt;- s %&gt;% follow_link(art) %&gt;% read_html()   &lt;br &gt; 
  str_replace_all(str_squish(page %&gt;% html_nodes(&quot;.AuthorName&quot;) %&gt;% html_text()), &quot;[0-9]|Email author&quot;, &quot;&quot;)&lt;br &gt;
  </code></pre>
  <p>And this returns a vector of all authors involved, in this case of length 8 for each of the authors. But now I need to follow the links on their names to get the affiliations, and their emails. I'm sure all the code I need is in  front of me but I'm a little lost as I'm new to R and web scraping (had to learn this  quickly for my current project).<br><br></p>
  <h1>Update<br></h1>
  <p>The answer below is perfect.</p>