[R] Question about ifelse() XXXX

2013-12-02 Thread Dan Abner
 Hi all,

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

 c1
  q1q2q3q4
q1 1.000 0.6668711 0.6948419 0.5758860
q2 0.6668711 1.000 0.6040746 0.4917447
q3 0.6948419 0.6040746 1.000 0.4730732
q4 0.5758860 0.4917447 0.4730732 1.000
 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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about ifelse() XXXX

2013-12-02 Thread Duncan Murdoch

On 02/12/2013 2:08 PM, Dan Abner wrote:

  Hi all,

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


FAQ 7.31.

Duncan Murdoch



 c1
   q1q2q3q4
q1 1.000 0.6668711 0.6948419 0.5758860
q2 0.6668711 1.000 0.6040746 0.4917447
q3 0.6948419 0.6040746 1.000 0.4730732
q4 0.5758860 0.4917447 0.4730732 1.000
 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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about ifelse() XXXX

2013-12-02 Thread William Dunlap
What is the value of
  diag(c1) - 1
?

(Or, use digits=16 when printing c1.)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of Dan Abner
 Sent: Monday, December 02, 2013 11:09 AM
 To: r-help@r-project.org
 Subject: [R] Question about ifelse() 
 
  Hi all,
 
 Can anyone explain what is happening with element 4,4 of c1? ifelse()
 is not recongizing it as value 1:
 
  c1
   q1q2q3q4
 q1 1.000 0.6668711 0.6948419 0.5758860
 q2 0.6668711 1.000 0.6040746 0.4917447
 q3 0.6948419 0.6040746 1.000 0.4730732
 q4 0.5758860 0.4917447 0.4730732 1.000
  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
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.