Checks whether x is an even or odd number. Only accepts numeric vectors.

is_even(x)

is_odd(x)

Arguments

x

Numeric vector or single numeric value, or a data frame or list with such vectors.

Value

is_even() returns TRUE for each even value of x, FALSE for odd values. is_odd() returns TRUE for each odd value of x and FALSE for even values.

Examples

is_even(4)
#> [1] TRUE
is_even(5)
#> [1] FALSE
is_even(1:4)
#> [1] FALSE  TRUE FALSE  TRUE

is_odd(4)
#> [1] FALSE
is_odd(5)
#> [1] TRUE
is_odd(1:4)
#> [1]  TRUE FALSE  TRUE FALSE