[R] combining identify() and locator()
bbolt at kalypsys.com
Fri Feb 27 18:09:50 CET 2009
awesome. Thank you very much for the quick response. I think this is
exactly what I was looking for.
On Feb 27, 2009, at 1:10 AM, Barry Rowlingson wrote:
> 2009/2/27 Brian Bolt <bbolt at kalypsys.com>:
>> I am wondering if there might be a way to combine the two functions
>> identify() and locator() such that if I use identify() and then
>> click on a
>> point outside the set tolerance, the x,y coordinates are returned
>> as in
>> locator(). Does anyone know of a way to do this?
>> Thanks in advance for any help
> Since "identify" will only return the indexes of selected points, and
> it only takes on-screen clicks for coordinates, you'll have to
> leverage "locator" and duplicate some of the "identify" work. So call
> locator(1), then compute the distancez to your points, and if any are
> below your tolerance mark them using text(), otherwise keep the
> coordinates of the click.
> You can use dist() to compute a distance matrix, but if you want to
> totally replicate identify's tolerance behaviour I think you'll have
> to convert from your data coordinates to device coordinates. The
> grconvertX and Y functions look like they'll do that for you.
> Okay, that's the flatpack delivered, I think you've got all the
> parts, some assembly required!
More information about the R-help