

Thank you very much, Michael!
That was exactly the hint I needed. I ended up using "try" as below, in case anyone happens to read this later on...
Works perfectly fine.
So yes, it _is_ amazing, what one can do with R ;-)

Regards,
Berry


internet <- try(read.table("http://www..."), silent=T )
if(!class(internet)=="try-error")
  {
  # take subset and write into file
  } else 
    {
    cat("connection not successfull\n")
    }



> CC: r-help@r-project.org
> From: michael.weylandt@gmail.com
> Subject: Re: [R] check whether connection can be opened
> Date: Wed, 18 Jul 2012 09:18:48 -0500
> To: berryboessenkool@hotmail.com
> 
> I think you'll need to roll your own using tryCatch() around open(). 
> 
> Michael
> 
> On Jul 18, 2012, at 5:09 AM, Berry Boessenkool <berryboessenkool@hotmail.com> wrote:
> 
> > 
> > 
> > Hi all,
> > 
> > I'm working on a function that reads online data that is only available to certain IPs. It then writes a subset of the data into a file.
> > So whenever I'm logged in elsewhere or am not connected to the internet, I get an error, and the function is terminated.
> > I want it to rather print a message into the file.
> > 
> > Is there any way to test whether a connection can be opened?
> > Analogous to isOpen something like canOpen...
> > Or would I want to look into the error handling options?
> > 
> > By the way, the data is the internet volume used so far, which I want to track regularly (on every R-Start via Rprofile).
> > My brother (a computer schientist in progress) did not know a solution, so I set out to try this with R - which I got to work fine (except the above mentioned). 
> > "R beats java", I told him, to which he responded nothing ;-)
> > Isn't it amazing, what one can do with R?
> > 
> > Thanks ahead,
> > Berry Boessenkool
> > 

 		 	   		  
	[[alternative HTML version deleted]]

