R/url_exists.R

Defines functions url_exists

url_exists <- function(url_in,
                       t=2){
  sapply(url_in, function(x){
    con <- url(x)
    check <- suppressWarnings(try(open.connection(con,open="rt",
                                                  timeout=t),
                                  silent=TRUE)[1])
    suppressWarnings(try(close.connection(con),silent=TRUE))
    ifelse(is.null(check),TRUE,FALSE)
  })
}

Try the rworkflows package in your browser

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

rworkflows documentation built on May 29, 2024, 2:37 a.m.