mercredi 1 avril 2015

R ifelse not giving me the right output

ifelse(BL0304_t2$BAXPFC11==1 & BL0304_t2$BAXPFC21==1 & BL0304_t2$BAXPFC31==1 & BL0304_t2$BAXPFC41==1, BL0304_t2$passcode<-1, BL0304_t2$passcode<-2)


This should give me '1' for passcode when the values for BAXPFC11,BAXPFC21, BAXPFC31, BAXPFC41 are 1 in and condition and should give me 2 otherwise. But this is giving me 2 in all cases. Unable to understand what is wrong with the code.


Aucun commentaire:

Enregistrer un commentaire