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.
A dirty work around would be using RCurl::getURL function.
RCurl::getURL
if (is.character(getURL("www.google.com"))) { out <- TRUE } else { out <- FALSE }