How to determine if you have an internet connection in R

后端 未结 9 1101
南旧
南旧 2020-11-30 01:16

Sometimes I need to download data from the internet. On occasions this has failed either because the website is down or because my computer has lost its internet connection.

9条回答
  •  粉色の甜心
    2020-11-30 01:36

    A dirty work around would be using RCurl::getURL function.

    if (is.character(getURL("www.google.com"))) {
        out <- TRUE
    } else {
        out <- FALSE
    }
    

提交回复
热议问题