【发布时间】:2021-03-14 16:25:10
【问题描述】:
我想从维基百科页面https://en.wikipedia.org/wiki/..中提取第20个表。
我现在使用这段代码,但它只提取第一个标题表。
the_url <- "https://en.wikipedia.org/wiki/..."
tb <- the_url %>% read_html() %>%
html_node("table") %>%
html_table(fill = TRUE)
我应该怎么做才能得到具体的?谢谢!!
【问题讨论】:
-
尝试
html_node(xpath = "//table[20]")而不是普通的html_node("table")。截至目前,它是该 html 中的第 20 个表。请注意,它的位置将来可能会发生变化。
标签: r