Identify points within a rectangle in a scatterplot
问题 I have a small R script that loads in a comma-separated file with data and displays it as a scatterplot. I can also identify individual points of interest in the scatterplot by hovering over them with the mouse. This is cool but what I also want is to draw a rectangle over an area in the scatterplot, and get a list with the IDs of the data points within that rectangle. (The final goal of this is a shiny app). I.e. how can I make it so that I can a) draw a rectangle, b) get the points within