[R] conditional assignment
uaca@alumni.uv.es
uaca at alumni.uv.es
Mon Jan 26 20:15:51 CET 2004
Hi all
I want to conditionally operate on certain elements of a matrix, let me
explain it with a simple vector example
> z<- c(1, 2, 3)
> zz <- c(0,0,0)
> null <- (z > 2) & ( zz <- z)
> zz
[1] 1 2 3
why zz is not (0, 0, 3) ?????
the null <- assignment is to keep the console silent
in the other hand, it curious that null has reasonable values
> null
[1] FALSE FALSE TRUE
Thanks in advance
Ulisses
Debian GNU/Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers." Pablo Picasso
Humans are slow, innaccurate, and brilliant.
Computers are fast, acurrate, and dumb.
Together they are unbeatable
---> Visita http://www.valux.org/ para saber acerca de la <---
---> Asociación Valenciana de Usuarios de Linux <---
More information about the R-help
mailing list