IdentifyA {DescTools}R Documentation

Identify Points in Plot Lying Within a Rectangle or Polygon


Find all the points lying either in a rectangle area spanned by an upper left and a bottom-right point or by a polygon area consisting of any number of points defined by point and click.


IdentifyA(x, ...)

## S3 method for class 'formula'
 IdentifyA(formula, data, subset, poly = FALSE, ...)
## Default S3 method:
 IdentifyA(x, y = NULL, poly = FALSE, ...)


x, y

x and y values of the points used to create the plot.


a formula, such as y ~ x specifying x and y values.
Here the formula must be entered that was used to create the scatterplot.


a data frame (or list) from which the variables in formula should be taken.


an optional vector specifying a subset of observations to be used.


logical. Defines if a polygon or a rectangle should be used to select the points. Default is rectangle. If a polygon should be used, set this argument to TRUE and select all desired points. The polygon will be closed automatically when finished.


Other arguments to be passed to IdentifyA.


Index vector with the points lying within the selected area. The coordinates are returned as text in the attribute "cond".


Andri Signorell <>

See Also

identify, locator


## Not run: 
# run the example via copy and paste

plot(temperature ~ delivery_min,
idx <- IdentifyA(temperature ~ delivery_min,

# you selected the following points[idx,]
points(temperature ~ delivery_min, data =[idx,], col="green")

# use the attr("cond") for subsets in code
attr(idx, "cond")

# create a group variable for the found points$grp <- seq(nrow( %in% idx

# try the polygon option
idx <- IdentifyA(temperature ~ delivery_min,, poly=TRUE)
points(temperature ~ delivery_min, data =[idx,], col="red")

## End(Not run)

[Package DescTools version 0.99.51 Index]