如何使用XML包刮取html表?
以Brazilian soccer team上的这个维基百科页面为例 . 我想在R中读取它并将"list of all matches Brazil have played against FIFA recognised teams"表作为data.frame获取 . 我怎样才能做到这一点?
如何使用XML包刮取html表?
以Brazilian soccer team上的这个维基百科页面为例 . 我想在R中读取它并将"list of all matches Brazil have played against FIFA recognised teams"表作为data.frame获取 . 我怎样才能做到这一点?
4 回答
Edited to add:
样本输出
使用Xpath的另一种选择 .
产生这个结果
rvest
和xml2
是另一个用于解析html网页的流行软件包 .语法比
xml
包更容易使用,对于大多数网页,包提供了所需的所有选项 .......或者更短的尝试:
挑选的表格是页面上最长的表格