library(httr)
r <- GET("http://httpbin.org/get")
status_code(r)
data$URLS
#Where data$URLS is a column of URLS
data$status <- GET(data$URLS)
status_code(data$URLS)
答案 0 :(得分:1)
我们可以使用for
循环
for(i in seq_along(urls)) {
tmp <- GET(urls[i])
print(status_code(tmp))
}
#[1] 200
#[1] 200
urls <-c("https://en.wikipedia.org/wiki/India","https://en.wikipedia.org/wiki/USA")