如何将从html_table获得的输出存储到变量中?:
library(rvest)
elec<-
read_html("https://en.wikipedia.org/wiki/Botswana_general_election,_1969")
elec%>%
html_nodes("table.wikitable")%>%
html_table(fill=TRUE)
答案 0 :(得分:1)
最小例子:
library(rvest)
data <- read_xml("url")
a <- data %>% xml_find_all("//node a") %>% xml_text()
b <- data %>% xml_find_all("//node b") %>% xml_text()
df = data.frame(a,b)