[R] Question about ifelse() XXXX

Dan Abner dan.abner99 at gmail.com
Mon Dec 2 20:08:44 CET 2013


 Hi all,

Can anyone explain what is happening with element 4,4 of c1? ifelse()
is not recongizing it as value 1:

> c1
          q1        q2        q3        q4
q1 1.0000000 0.6668711 0.6948419 0.5758860
q2 0.6668711 1.0000000 0.6040746 0.4917447
q3 0.6948419 0.6040746 1.0000000 0.4730732
q4 0.5758860 0.4917447 0.4730732 1.0000000
> ifelse(c1==1,1,0)
   q1 q2 q3 q4
q1  1  0  0  0
q2  0  1  0  0
q3  0  0  1  0
q4  0  0  0  0
> c1[4,4]
[1] 1



More information about the R-help mailing list