Extracting hrefs from a list in R with some missing values
<p>I am keen to extract the source and demo urls for a set of jekyll themes into a data.frame</p>

<pre><code>library(rvest)

info &lt;- read_html("https://github.com/jekyll/jekyll/wiki/themes")

data &lt;- info %&gt;%
 html_nodes(" #wiki-body li")

data
{xml_nodeset (115)}


[11] &lt;li&gt;Typewriter - (&lt;a href="https://github.com/alixedi/typewriter"&gt;source&lt;/a&gt;, &lt;a href="http://alixedi.github.io/typewriter"&gt;demo&lt;/a&gt;)&lt;/li&gt;
[12] &lt;li&gt;block-log - (&lt;a href="https://github.com/anandubajith/block-log"&gt;source&lt;/a&gt;), &lt;a href="https://anandu.net/demo/block-log/"&gt;demo&lt;/a&gt;)&lt;/li&gt;
[13] &lt;li&gt;Otter Pop - (&lt;a href="https://github.com/tybenz/otter-pop"&gt;source&lt;/a&gt;)&lt;/li&gt;
</code></pre>

<p>So I want a data.frame(df) with 3 columns e.g</p>

<pre><code>name        source                                       demo
Typewriter   https://github.com/alixedi/typewriter         http://alixedi.github.io/typewriter
</code></pre>

<p>I am able to extract all  hrefs as a vector but, as you can see, from [13] there is no demo for some of the sites so I then encounter difficulties</p>

<p>Is there a simple way I can create df from data? Possibly using the purrr library</p>