Skip to contents

Tests whether the elements of a character vector are Uniform Resource Locators (URLs).

Usage

is_url(x)

Arguments

x

Character vector to test.

Value

A logical vector of the same length as x.

Details

This function is based on xml2::url_parse() and simply checks whether the elements in x contain both a scheme as well as some scheme-specific part (excl. ports). No further checks are performed, so it's explicitly not verified that a URL actually conforms to its respective scheme.

See also

Other HTTP functions: assert_mime_type(), is_http_success(), req_cached()

Examples

pal::is_url(c("/some/path",
              "file:///some/path"))
#> [1] FALSE  TRUE