<snip>I want to conditionally operate on certain elements of a matrix, let me explain it with a simple vector example
[1] 1 2 3z<- c(1, 2, 3) zz <- c(0,0,0) null <- (z > 2) & ( zz <- z) zz
why zz is not (0, 0, 3) ?????
in the other hand, it curious that null has reasonable values
null[1] FALSE FALSE TRUE
What you have done there is create a boolean vector, null, of the same length as z (and zz).
For instance: (z > 2) & (zz <- z) =(F F T) & (T T T) (as assignment - presumably - returns T) =(F F T).
What will work is: z <- c(1, 2, 3) index <- z>2 zz <- z * index
-- SC
Simon Cullen Room 3030 Dept. Of Economics Trinity College Dublin
Ph. (608)3477 Email [EMAIL PROTECTED]
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
