Write a function is_even() that accepts a vector of integers (for simplicity, you don’t have to worry about input checking) and returns a logical vector that is TRUE whenever the input value is even, FALSE whenever the input value is odd, and NA whenever the input value is nonfinite (i.e. for anything that will make is.finite() return FALSE: Inf, -Inf, NA and NaN). Check your function with the input vector c(-5:5, Inf, -Inf, NA, NaN) (no need to store this result in an object).

Hint: you may want to consult the help page of the modulo operator %%.

(from: Cotton, 2013, Learning R, O’Reilly)