我想从仅按数字更改的多个URL中抓取Web数据并将其放入一个数据帧enter code here
中
URL示例:https://necta.go.tz/results/2015/csee/results/p0101.htm
URL上唯一改变的是“ p0101”变成“ p0102”,“ p0103”等。
我在R中使用了下面的代码,但我非常困惑。
R-CODE ..参见下文
dflist <- map(.x = 0101:1000, .f = function(x) {
Sys.sleep(5)
url <- paste0("https://necta.go.tz/results/2015/csee/results/p",x,".htm")
read_html(url) %>%
html_nodes('.excerpt') %>%
htmlTreeParse(url,useInternalNodes = TRUE)
getNodeSet(ExtractHTML1,"//tr//font")
html_text() %>%
as.data.frame()
}) %>% do.call(rbind, .)