圣诞快乐给stackoverflow
团队和读者!
我正在使用Rstudio
而我正在努力从网页中检索html
table
。网页位于here,我要检索的表格包含以下XPath:// * [@ id =" h2hMatches"]
以下是我在R
代码方面尝试过的内容:
library(rvest)
library(magrittr)
webpage <- read_html("https://www.soccerpunter.com/soccer-statistics/England/Premier-League-2017-2018/head_to_head_statistics/all/675_Tottenham_Hotspur_FC/670_Southampton_FC")
tbls <- html_nodes(webpage, "table")
head(tbls)
以上输出如下:
{xml_nodeset (6)}
[1] <table border="0" align="center" cellpadding="4" cellspacing="1" class="normaltext">\n<tr>\n<td colspan="2" class= ...
[2] <table border="0" cellpadding="0" cellspacing="0" id="content">\n<!--DWLayoutTable--><tr>\n<td valign="top" id="ce ...
[3] <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>\n<td><table width="640" cellpadding="0" cellsp ...
[4] <table width="640" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">\n<tr>\n<td> \r\n\r\n ...
[5] <table id="h2hHead" width="100%">\n<tr>\n<td width="200"><h2><a href="/soccer-statistics/England/Premier-League-20 ...
[6] <table id="matchInfo" class="infoTable">\n<tr>\n<td class="infoName">Competition:</td>\n <t ...
我找不到表格ID等于&#34; h2Matches&#34;从输出。
我做错了什么?是否有另一种方法来检索特定的表?