IdentifyA | R Documentation |
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. |
formula |
a |
data |
a data frame (or list) from which the variables in
|
subset |
an optional vector specifying a subset of observations to be used. |
poly |
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 |
... |
Other arguments to be passed to |
Index vector with the points lying within the selected area.
The coordinates are returned as text in the attribute "cond"
.
Andri Signorell <andri@signorell.net>
identify
, locator
## Not run:
# run the example via copy and paste
plot(temperature ~ delivery_min, data=d.pizza)
idx <- IdentifyA(temperature ~ delivery_min, data=d.pizza)
# you selected the following points
d.pizza[idx,]
points(temperature ~ delivery_min, data = d.pizza[idx,], col="green")
# use the attr("cond") for subsets in code
attr(idx, "cond")
# create a group variable for the found points
d.pizza$grp <- seq(nrow(d.pizza)) %in% idx
# try the polygon option
idx <- IdentifyA(temperature ~ delivery_min, data=d.pizza, poly=TRUE)
points(temperature ~ delivery_min, data = d.pizza[idx,], col="red")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.