[R] How to use "identify"

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Jan 24 11:52:43 CET 2005


David Parkhurst wrote:
> I can't get identify to work, using R 2.0.1 under windows xp pro, 
> service pack 2.  Here's what I enter, and the result:
> 
>  > plot((our.frame2$c1),(our.frame2$c9))  # Produces desired plot
>  > identify(our.frame2$c1) # Plot comes to forefront, so I select a point
> warning: no point with 0.25 inches
> numeric(0)
> 
> Is my call to identify correct?  The help page for indentify (from 
> ?identify) doesn't give any examples, so I don't know what the "x" 
> should be.  I right click right on top of one of the points, then left 
> click and select stop.
> 
> Thanks for any help.
> 
> Dave Parkhurst

You forgot to pass in your y coordinates in your call to identify(). You 
can only leave off the y argument in certain circumstances (see ?identify)

Here's an example:

xdat <- rnorm(10)
ydat <- rnorm(10)
plot(xdat, ydat)
identify(xdat, ydat)

So you need:

plot(our.frame2$c1, our.frame2$c9) # you don't need the extra brackets
identify(our.frame2$c1, our.frame2$c9)

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list