[R] Why doesn't this work ?

eric ericstrom at aol.com
Thu Mar 17 04:25:36 CET 2011


Why doesn't this work and is there a better way ?

z <-ifelse(t==1 || 2 || 3, 1,0)
t <-3
z
[1] 1
t <-4
z
[1] 1

trying to say ...if t == 1 or if t== 2 or if t ==3 then true, otherwise
false

--
View this message in context: http://r.789695.n4.nabble.com/Why-doesn-t-this-work-tp3383656p3383656.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list