Return TRUE if n is an integer evenly divisibly by 2.
isEven(n)
n | A numeric vector. |
---|
A logical vector the same length as n. TRUE if n is an integer and is even, FALSE if n is an integer and not even, NA otherwise.
Test whether elements of a numeric vector are even. For whole numbers return TRUE or FALSE. For decimals return NA.
David Braze davebraze@gmail.com
n <- 1:10 isEven(n)#> [1] FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE#> [1] FALSE NA TRUE NA FALSE NA TRUE NA FALSE NA TRUE NA #> [13] FALSE NA TRUE NA FALSE NA TRUE