You could use the RCurl
package:
R> library(RCurl)
Loading required package: bitops
R> url.exists("http://google.com")
[1] TRUE
R> url.exists("http://csgillespie.org")
[1] FALSE
Alternatively, you could use the httr
package
R> library(httr)
R> http_status(GET("http://google.com"))
$category
[1] "success"
$message
[1] "success: (200) OK"
R> http_status(GET("http://csgillespie.org"))
$category
[1] "server error"
$message
[1] "server error: (503) Service Unavailable"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…