Identify does sort the locations
Hi Indeed the help page says ... "the indices of the identified points, in the order they were identified" ... and that is a complete lie. Sorry about that :( The simplest thing would be to correct the help page. It would be possible to have identify() return the order, though for backward compatibility that should not be the default, so would require another argument to identify(). Paul
On 16/02/18 06:58, Samuel GRANJEAUD IR/INSERM wrote:
Hi, Using identify function, I think I should get the index of the selected points in the order I clicked them. This is what I read in the help. But I feel they are ordered. Please let me know what I missed. In the following example, I clicked on the points labelled 7, 5 and 1, but I get 1, 5, 7 as output.
set.seed(0); x = rnorm(10); y = rnorm(10); plot(x,y); text(x, y, seq(x)); sel = identify(x,y); sel
[1] 1 5 7 Any help appreciated, Samuel R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 Matrix products: default locale: [1] LC_COLLATE=English_United Kingdom.1252? LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats???? graphics? grDevices utils???? datasets? methods?? base loaded via a namespace (and not attached): [1] compiler_3.4.3
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/