Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

html_attr “href” returns only one result in rvest

$
0
0

My goal is to exact urls from a wiki page and there is a table of congress members and I want to exact their own wiki urls.

My input is like:

url_congress <- "https://en.wikipedia.org/wiki/List_of_current_United_States_senators"
mynodes <- html_node(congress, ".fn a")
urls <- html_attr(mynodes, name = "href")
urls

However, it only selected the first url instead of all urls:

[1] "/wiki/Richard_Shelby"

What should I do if I want to select all urls in the table?


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>