This website does not use the html table, so html_table()
cannot find anything. It actsaully uses div
column
and data lastcolumn
.
So you can do something like
url <- "http://www.marketwatch.com/investing/stock/IRS/profile" valuation_col <- url %>% read_html() %>% html_nodes(xpath='//*[@class="column"]') valuation_data <- url %>% read_html() %>% html_nodes(xpath='//*[@class="data lastcolumn"]')
Or even
url %>% read_html() %>% html_nodes(xpath='//*[@class="section"]')
To get most of the way from you.
Also read their terms of use - especially 3.4.
source share