Subject: Re: [R] Easy way?
From: Yves Gauvreau (cyg@sympatico.ca)
Date: Mon 26 Jun 2000 - 21:03:03 EST
Message-ID: <00a801bfdf5e$196a9b00$0201a8c0@Workgroup>
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@statistik.uni-dortmund.de>
To: "Yves Gauvreau" <cyg@sympatico.ca>
Cc: "r-help" <r-help@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@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 2b25 : Mon 17 Jul 2000 - 12:33:24 EST