Re: [R] Identify does sort the locations
Hi Samuel GRANJEAUD, Isn't this loop more simple to retain the click-order: result = numeric(n) for (i in 1:n) { id = identify(x, y, n=1) result[i] = id } Hope this helps, Best regards, Franklin Bretschneider Dept of Biology Utrecht University brets...@xs4all.nl __ R-help@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.
Re: [R] Identify does sort the locations
Thanks Paul. I have started using locator(). I also found the gatepoints package that sounds interestering. https://CRAN.R-project.org/package=gatepoints Happy R, Samuel On 15-02-2018 21:50, Paul Murrell wrote: Hi Sorry, I think this has always been the behaviour (and the documentation has always been wrong). Using locator() yourself could be a workaround (with a little more effort required to determine the closest data point). Paul __ R-help@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.
Re: [R] Identify does sort the locations
Hi Paul, Thanks for your answer. I am wondering if in the previous versions, let's say 2.1x, the data were in the selection order... Let me know if there a R fonction taht I can code. Do you think I should use locator function and match points on my own? Best, Samuel __ R-help@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.
Re: [R] Identify does sort the locations
Hi Sorry, I think this has always been the behaviour (and the documentation has always been wrong). Using locator() yourself could be a workaround (with a little more effort required to determine the closest data point). Paul On 16/02/18 09:32, Samuel GRANJEAUD IR/INSERM wrote: Hi Paul, Thanks for your answer. I am wondering if in the previous versions, let's say 2.1x, the data were in the selection order... Let me know if there a R fonction taht I can code. Do you think I should use locator function and match points on my own? Best, Samuel -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ __ R-help@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.
Re: [R] 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@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 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ __ R-help@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.
[R] Identify does sort the locations
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@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.