Skip to contents

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"))
#> [1] FALSE  TRUE

is_ip(c("163.114.132.0", "7.114.132", "0.0.0.0", "1.1.1.1."))
#> [1]  TRUE FALSE  TRUE FALSE

are_id(1:10)
#> [1] FALSE
are_id(LETTERS[1:10])
#> [1] TRUE

are_constant(rep(1, 10))
#> [1] TRUE
are_constant(1:10)
#> [1] FALSE

are_binary(c("A", "B", "A"))
#> [1] TRUE