[R] Easy way?

Yves Gauvreau cyg at sympatico.ca
Mon Jun 26 13:03:03 CEST 2000


Thank you all.

I find it incredible to see so many response to such a simple query. I guess
I'm still hook to Matlab and the likes, I would probably never have though
of these approach alone.

Regards.

YG



----- Original Message -----
From: "Uwe Ligges" <ligges at statistik.uni-dortmund.de>
To: "Yves Gauvreau" <cyg at sympatico.ca>
Cc: "r-help" <r-help at stat.math.ethz.ch>
Sent: Monday, June 26, 2000 2:32 AM
Subject: Re: [R] Easy way?


> > Yves Gauvreau wrote:
> >
> > Hi,
> >
> > Say I have this vector x <- sort(rnorm(n)). I'd like to know if there
> > is a nice way to find out the index of the nearest x to say 1.5?
>
> I would try:
>  which(abs(x - 1.5) == min(abs(x - 1.5)))
>
>
> Uwe Ligges
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> 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 at 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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list