Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is.even

Identify Even or Odd Numbers


Description

Simple functions to test for or return the even or odd numbers.

Usage

is.even(x)
is.odd(x)
even(x)
odd(x)

Arguments

x

any numeric, but maybe makes the most sense with integers.

Details

Return a logical vector/matrix of the same dimension as the argument x telling whether each component is odd (is.odd) or even (is.even), or return just the even (even) or odd (odd) numbers from the vector/matrix. Uses %%.

Value

Returns a logical vector/matrix/array of the same dimension as x in the case of is.even and is.odd, and returns a vector of length less than or equal to x in the case of even and odd; or if no even/odd values, returns integer(0).

Author(s)

Eric Gilleland

See Also

%%

Examples

is.even( 1:7 )
is.odd( 1:7 )
even( 1:7 )
odd( 1:7 )

distillery

Method Functions for Confidence Intervals and to Distill Information from an Object

v1.2
GPL (>= 2)
Authors
Eric Gilleland
Initial release
2020-11-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.