This function opens a connection to the specified URL to check its validity.
It returns TRUE
if the URL is valid (i.e., the connection can be opened),
and FALSE
otherwise.
Source
The source code of this function was taken from this stackoverflow discussion.
Examples
load_packages(purrr, tibble)
urls <- c(
"http://www.amazon.com", "http://this.isafakelink.biz",
"https://stackoverflow.com", "https://stackoverflow505.com")
purrr::map_dfr(urls, ~tibble::tibble(URL = .x, Valid = check_url(.x)))
#> # A tibble: 4 × 2
#> URL Valid
#> <chr> <lgl>
#> 1 http://www.amazon.com TRUE
#> 2 http://this.isafakelink.biz FALSE
#> 3 https://stackoverflow.com TRUE
#> 4 https://stackoverflow505.com FALSE