The tables I would like to scrape have url's in them. If I run the code, I get only the column with description of url. How to get the table which actually has a column (in mycase the second column) with URLs instead of their descriptions), or having a full html code of an anchor?. I need it to extract two index codes from the URL's in the second column of table. The links that I would like to scrape look like: https://aplikacje.nfz.gov.pl/umowy/Agreements/GetAgreements?ROK=2017&ServiceType=03&ProviderId=20795&OW=15&OrthopedicSupply=False&Code=150000001 and I need ProviderId and Code numbers but fist I need the links in the table scraped by the code below.
table<-0
library(rvest)
for (i in 1:10){
url<-paste0("https://aplikacje.nfz.gov.pl/umowy/Provider/Index?ROK=2017&OW=15&ServiceType=03&OrthopedicSupply=False&page=",i)
page<-html_session(url)
table[i]<-html_table(page)
}
Thanks for all the comments and help.
This shld help get a nice, clean, complete table with the hrefs you want:
Here's how to get them from one page. Note that I use the %>% operator, which makes for easier reading, but you could just nest the calls if you prefer