次の例を考えます。
sites=c('site 1','site 2')
link=c('<a href="http://example.com/path">This website</a>', '<a href="http://example.com/path2">That website</a>')
w=data.frame(link,sites)
w
link sites
<a href="http://example.com/path">This website</a> site 1
<a href="http://example.com/path2">That website</a> site 2
HTML スニペットを解析して URL とリンク テキストを抽出し、それらをデータ フレームの個別の列にポップする正規表現を適用するにはどうすればよいですか? たとえば、上記の例では、次のようなデータ フレームを生成するにはどうすればよいでしょうか。
url name sites
http://example.com/path This website site 1
http://example.com/path2 That website site 2