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