Re: [R] Closest value

2008-08-27 Thread Doran, Harold
Maybe this which.min(abs(x.axis-3.2)) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dani Valverde > Sent: Wednesday, August 27, 2008 9:13 AM > To: R Help > Subject: [R] Closest value > > Hello, > I have this comman

Re: [R] Closest value

2008-08-27 Thread Henrique Dallazuanna
Try this: x.axis[which.min(abs(x.axis - 3.2))] On Wed, Aug 27, 2008 at 10:12 AM, Dani Valverde <[EMAIL PROTECTED]> wrote: > Hello, > I have this command: > x.axis <- seq(from=0.5, to=4.5, length.out=13112) > How can I which of the x.axis components is the closest to a given value, > for example 3

[R] Closest value

2008-08-27 Thread Dani Valverde
Hello, I have this command: x.axis <- seq(from=0.5, to=4.5, length.out=13112) How can I which of the x.axis components is the closest to a given value, for example 3.2? Best, Dani -- Daniel Valverde Saubí Grup de Biologia Molecular de Llevats Facultat de Veterinària de la Universitat Autònoma