我想从网络http://en.wikipedia.org/wiki/Brazil_national_football_team中提取一个表格
library(XML)
baseURL <- "http://en.wikipedia.org/wiki/Brazil_national_football_team"
xmltext <- htmlParse(baseURL)
xmltable <- xpathApply(xmltext, "//table[.//tbody//tr//th//a[@title='CONCACAF Gold Cup']]")
这是 xpath :"//table[.//tbody//tr//th//a[@title='CONCACAF Gold Cup']]"
两者都不
xmltable <- xpathApply(xmltext, "//table[.//tbody//tr//th//a[@title='CONCACAF Gold Cup']]")
也不
xmltable <- xpathApply(xmltext, "//table[//tbody//tr//th//a[@title='CONCACAF Gold Cup']]")
可以得到指定的表。如何编写 xpath 表达式?
请看附件。