Answers for "how to use ifelse in r"

1

how to use ifelse in r

> a = c(5,7,2,9)
> ifelse(a %% 2 == 0,"even","odd")
[1] "odd"  "odd"  "even" "odd"
Posted by: Guest on July-13-2021

Browse Popular Code Answers by Language