Extract HyperLinks from Webpage using R
<p>Need help to extract hyper link of each product (like Philadelphia: One Liberty Observation Deck ) from below page :</p>

<p><a href="https://www.getyourguide.com/s/?q=Philadelphia" rel="nofollow">https://www.getyourguide.com/s/?q=Philadelphia</a></p>

<p>I have applied general approach like :</p>

<pre><code>url &lt;- "http://www.viator.com/search/Philadelphia"
doc &lt;- htmlParse(url)
links &lt;- xpathSApply(doc, "//a/@href") 
</code></pre>

<p>but I am getting error.
I am looking for output data frame like</p>

<pre><code>product1: Philadelphia: One Liberty Observation Deck 
link1 : "https://www.getyourguide.com/philadelphia-l60/philadelphia-one-liberty-observation-deck-t61908/"

product2 : Philadelphia Hop-on Hop-off Bus Tour Tickets
link2 : "https://www.getyourguide.com/philadelphia-l60/philadelphia-hop-on-hop-off-bus-tour-t47403/"
</code></pre>

<p>Again, I am very new to all that is programming, so any help or code snippets will be greatly appreciated.</p>