i have this kind of data
t1 <- data.frame(c1=c(1,2,5,NA,3,2),c2=c(1,3,NA,NA,8,3),c3=c(NA,8,7,NA,8,4))
> t1
c1 c2 c3
1 1 1 NA
2 2 3 8
3 5 NA 7
4 NA NA NA
5 3 8 8
6 2 3 4
is it possible to shorten this kind of expression?
ifelse(t1["c1"] == 1 | t1["c1"] == 2 | t1["c1"] == 3, "yes", "no")
something like this doesnt work:
ifelse(t1["c1"] %in% c(1,2,3), "yes", "no")