Skip to content
Prev 361073 / 398506 Next

if else condition - help

if you want to use 'ifelse', here is a way:
+ structure(c(0.0990217544905328, 1.60623837694539, -0.104331330281166,
+ -2.91485614212114, -0.108388742328104, -1.41670341534772,
-1.70609114096417,
+ 2.92018951284015, 0.201868946570178, 0.907637296638577,
-0.403004972105994,
+ -2.47718015803221, -0.354616729237253, -0.316113789733413,
1.01532974064126,
+ -2.69915170731852), .Dim = c(4L, 4L), .Dimnames = list(c("A",
+ "B", "C", "D"), c("C1", "C2", "C3", "C4")))
+             , 1
+             , ifelse(k < -1.5
+                 , -1
+                 , 0
+                 )
+             )
num [1:4, 1:4] 0 1 0 -1 0 0 -1 1 0 0 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:4] "A" "B" "C" "D"
  ..$ : chr [1:4] "C1" "C2" "C3" "C4"
C1 C2 C3 C4
A  0  0  0  0
B  1  0  0  0
C  0 -1  0  0
D -1  1 -1 -1
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Sun, May 22, 2016 at 1:58 PM, Adrian Johnson <oriolebaltimore at gmail.com>
wrote: