identify.formula: Identify Points In a Plot Using a Formula
Description
The function identify reads the position of the graphics pointer when
the (first) mouse button is pressed. It then searches the
coordinates given in x and y for the point closest to the
pointer. If this point is close enough to the pointer,
its index will be returned as part of the value of the
call.
Usage
# S3 method for formula
identify (formula, data, subset, na.action, ...)
Value
If pos is FALSE, an integer vector containing the
indices of the identified points, in the order they were identified.
If pos is TRUE, a list containing a component
ind, indicating which points were identified and a component
pos, indicating where the labels were placed relative to the
identified points (1=below, 2=left, 3=above, 4=right and 0=no offset,
used if atpen = TRUE).
Arguments
formula
a formula of the form lhs ~ rhs where lhs gives the data values and rhs the corresponding groups.
data
The data frame from which the formula should
be evaluated.
subset
an optional vector specifying a subset of observations to be used.
na.action
a function which indicates what should happen when the data contain NAs. Defaults to
getOption("na.action").
if (FALSE) {
## Copy and try in an interactive R sessionplot(dist ~ speed, data = cars, subset = speed < 17)
identify(dist ~ speed, data = cars, subset = speed < 17)
}