Re: [R] Test internet presence

From: Gregor Gorjanc <>
Date: Mon 11 Sep 2006 - 22:49:10 GMT

Prof Brian Ripley <ripley <at>> writes: ...
> Check out tests/internet.R. nsl() checks if you can resolve host names,
> which has worked well enough there.

Thank you prof. Ripley for this pointer. I am posting here the relevant part if someone does not look at SVN. I would just like to ask why is .Platform$OS.type == "unix" added to the test? Is nsl() available only on unix like platforms or ... I did not found any specifics in its help page.

if(!capabilities()["http/ftp"]) {

    warning("no internet capabilities")

if(.Platform$OS.type == "unix" &&

   is.null(nsl(""))) q()

Does it make any sense to write a function that would use these two tests.

isNetAvailable <- function()
  ifelse(!capabilities()["http/ftp"] &&

##         .Platform$OS.type == "unix" && ## ??? 


Regards, Gregor mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue Sep 12 16:15:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 12 Sep 2006 - 16:27:52 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.