R/areyouthere.R

#' Verifies whether the server is alive
#'
#' @return TRUE if the server if alive, FALSE otherwise.
#'
#' @examples
#' \dontrun{
#' areyouthere()
#' }
#'
#' @export

areyouthere <- function() {
  res <- jsonlite::fromJSON('https://api.repec.org/call.cgi?areyouthere=1')

  if ('error' %in% names(res) && ncol(res) > 1) {
    return(TRUE)
  } else {
    return(FALSE)
  }
}

#' @rdname areyouthere
#' @export
are_you_there <- areyouthere

Try the repec package in your browser

Any scripts or data that you put into this service are public.

repec documentation built on May 1, 2019, 7:20 p.m.