[R] Error when scan()ning dead URL's

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Nov 15 14:40:10 CET 2004


"Jonathan Croft" <OG1092 at hotmail.com> writes:

> I often scan web pages directly into R using
> 
> scan('http://etc...','')
> 
> however this gives an error if the page/url doesn't exist, or the connection
> to it is not available.
> Is it possible to still use scan but have R return something other than an
> error (which crashes code)
> when the page or the connection isn't available.

Can't you just wrap it in a try() construct?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list