Skip to content
Prev 43237 / 398513 Next

conditional assignment

On Mon, 26 Jan 2004 20:15:51 +0100, <uaca at alumni.uv.es> wrote:

            
<snip>
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