【发布时间】:2016-02-29 19:06:55
【问题描述】:
使用以下 documentation 我一直在尝试从 marketwatch.com 上抓取一系列表格
这是下面代码所代表的:
链接和xpath已经包含在代码中:
url <- "http://www.marketwatch.com/investing/stock/IRS/profile"
valuation <- url %>%
html() %>%
html_nodes(xpath='//*[@id="maincontent"]/div[2]/div[1]') %>%
html_table()
valuation <- valuation[[1]]
我收到以下错误:
Warning message:
'html' is deprecated.
Use 'read_html' instead.
See help("Deprecated")
提前致谢。
【问题讨论】:
-
删除
html()并替换为read_html() -
这不是错误,而是警告。您的代码仍会在该警告下运行。
标签: r xpath web-scraping rvest