ifelse in r numeric code example Example: ifelse in r > a = c(5,7,2,9) > b = ifelse(a %% 2 == 0,"even","odd") # b: odd odd even odd