tests/isUrl.R

library("R.utils")

urls <- c(
  "http://www.r-project.org/",
  "ftp://cran.r-project.org/",
  "htttp://www.r-project.org/",  ## typo, but still a URL
  "",                            ## empty
  NA_character_                  ## missing
)

print(urls)

res <- sapply(urls, FUN=isUrl)
print(res)

res <- isUrl(urls)
print(res)
stopifnot(is.logical(res))
stopifnot(length(res) == length(urls))
stopifnot(!any(is.na(res)))

Try the R.utils package in your browser

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

R.utils documentation built on Nov. 18, 2023, 1:09 a.m.