[R] simplify this instruction

CE.KA ce.kaya75 at yahoo.fr
Wed Nov 19 22:42:39 CET 2008


Hi R users,

Is there a way to simplify this instruction:
ifelse(B=="0","A",
ifelse(B=="1","A",
ifelse(B=="2","A",
ifelse(B=="3","A",
ifelse(B=="4","A",
ifelse(B=="5","A",
ifelse(B=="6","A",
ifelse(B=="7","A",
ifelse(B=="8","A",
ifelse(B=="9","A","B"))))))))))

i am looking for something like this:

ifelse(B=="(0:9)","A","B")

Best regards
-- 
View this message in context: http://www.nabble.com/simplify-this-instruction-tp20589904p20589904.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list