[R] test if a url exists

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jun 29 08:05:43 CEST 2014


On 29/06/2014, 7:12 AM, Hui Du wrote:
> Hi all,
> 
> I need to test if a url exists. I used url.exists() in RCurl package
> 
> library(RCurl)
> 
> however the test result is kind of weird. For example,
> 
>> url.exists("http://www.amazon.com")
> [1] FALSE
> 
> although www.amazon.com<http://www.amazon.com> is a valid url. Does anybody know how to use that function correctly or the other way to test url existence?

You can use the .header = TRUE option to that call to see the error 405
that it gives.

Duncan Murdoch



More information about the R-help mailing list