R/brapi_canInternet.R

Defines functions brapi_canInternet

Documented in brapi_canInternet

#' @title
#' brapi_canInternet
#'
#' @description
#' Check for internet connection.
#'
#' @param url character; A url to check. Default is \href{https://www.google.org}{www.google.org}.
#'
#' @return NULL when internet access is available or ERROR when internet access is not available
#'
#' @author Maikel Verouden
#'
#' @references \href{http://stackoverflow.com/questions/5076593/how-to-determine-if-you-have-an-internet-connection-in-r}{Stack Overflow} and \code{\link[curl]{has_internet}}
#'
#' @family brapiutils
#'
#' @importFrom curl nslookup
#'
#' @export
brapi_canInternet <- function(url = "www.google.org") {
  stopifnot(is.character(url))
  return(invisible(curl::nslookup(host = url)))
}
mverouden/brapir-v2 documentation built on April 22, 2022, 9:24 a.m.