From: Achim Zeileis (zeileis@ci.tuwien.ac.at)
Date: Wed 19 Jun 2002 - 00:26:14 EST
Message-id: <3D0F4306.806A571E@ci.tuwien.ac.at>
Poizot Emmanuel wrote:
>
> Hi,
> I've got a trivial question ,but as a newby, I'm stuk.
> I've got an array of dim 160,4. I want to extract the values of the first
> column based on a condition of values in the second column and affect the
> result to a variable.
If I understand you correctly you want something like this:
R> dummy <- matrix(rnorm(160*4), ncol = 4)
R> dim(dummy)
[1] 160 4
R> result <- dummy[(dummy[,2] > 2), 1]
R> result
[1] 1.1762235 0.3720527
Hope that helps
Z
> E.P.
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:32 EST