1

我需要从以下 URL 中提取一个表:http: //stats.espncricinfo.com/ci/engine/records/team/match_results.html ?class=2;id=2013;type=year

我只需要标题为“匹配结果”的表格

我使用了以下代码: library(XML) ODItable <- readHTMLTable(' http://stats.espncricinfo.com/ci/engine/records/team/match_results.html?class=2;id=2013;type=year ' )

如何从此处提取特定表?

4

1 回答 1

0

你几乎拥有它!

library(XML) 
url <- 'http://stats.espncricinfo.com/ci/engine/records/team/match_results.html?class=2;id=2013;type=year'
ODItable <- readHTMLTable(url)
head(ODItable$`Match results`)

     Team 1    Team 2    Winner    Margin    Ground   Match Date  Scorecard
1     India  Pakistan  Pakistan   85 runs   Kolkata  Jan 3, 2013 ODI # 3315
2     India  Pakistan     India   10 runs     Delhi  Jan 6, 2013 ODI # 3316
3 Australia Sri Lanka Australia  107 runs Melbourne Jan 11, 2013 ODI # 3317
4     India   England   England    9 runs    Rajkot Jan 11, 2013 ODI # 3318
5 Australia Sri Lanka Sri Lanka 8 wickets  Adelaide Jan 13, 2013 ODI # 3319
6     India   England     India  127 runs     Kochi Jan 15, 2013 ODI # 3320
于 2013-11-05T19:12:55.157 回答