is_valid_url {healthyR.data} | R Documentation |
Check if a URL is valid
Description
This function validates a URL by checking the presence of a scheme and a hostname in the parsed URL.
Usage
is_valid_url(url)
Arguments
url |
A character string representing the URL to be checked. |
Details
The function uses the httr2::url_parse
function to parse the URL
and checks if the parsed URL contains a scheme and a hostname. If either
is missing, the URL is considered invalid.
Value
A logical value: TRUE
if the URL is valid, FALSE
otherwise.
Author(s)
Steven P. Sanderson II, MPH
Examples
is_valid_url("https://www.example.com") # TRUE
is_valid_url("not_a_url") # FALSE
[Package healthyR.data version 1.1.1 Index]