Are elements of a vector even?
are_even(
x,
check_integerish = TRUE,
keep_nas = TRUE,
nThread = getOption("hutilscpp.nThread", 1L)
)which_are_even(x, check_integerish = TRUE)
For are_even
, a logical vector the same length as x
,
TRUE
whenever x
is even.
For which_are_even
the integer positions of even values in x
.
An integer vector. Double vectors may also be used, but will
be truncated, with a warning if any element are not integers.
Long vectors are not supported unless x
is integer and keep_nas = FALSE
.
(logical, default: TRUE
) Should the
values in x
be checked for non-integer values
if x
is a double vector. If TRUE
and values are found to be non-integer a warning is emitted.
(logical, default: TRUE
) Should NA
s in x
return NA
in the result? If FALSE
, will return TRUE
since
the internal representation of x
is even. Only applies if is.integer(x)
.
Number of threads to use.