is_url: Check if input is_* or are_*

View source: R/checks.R

is_urlR Documentation

Check if input is_* or are_*

Description

Check whether a value or vector is or is not following a set of rules. For example: is an URL, is an ID vector, are non-variant or constant values, are binary values... Notice that is_ will return the result for each observation and are_ for the whole vector.

Usage

is_url(x, ...)

is_ip(x, ...)

are_id(x)

are_constant(x)

are_binary(x)

Arguments

x

Vector

...

Additional parameters passed to grepl()

Value

is_url. Boolean. Result of checking if x is a valid URL string.

is_ip. Boolean. Result of checking if x is a valid IP string.

are_id. Boolean. Result of checking if x is a potential ID vector

are_constant. Boolean. Result of checking if x is a constant vector

are_binary. Boolean. Result of checking if x is a binary vector

Examples

is_url(c("google.com", "http://google.com"))

is_ip(c("163.114.132.0", "7.114.132", "0.0.0.0", "1.1.1.1."))

are_id(1:10)
are_id(LETTERS[1:10])

are_constant(rep(1, 10))
are_constant(1:10)

are_binary(c("A", "B", "A"))

laresbernardo/lares documentation built on Oct. 23, 2024, 12:05 p.m.