Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Rolf Turner
On 2/12/2009, at 3:48 PM, Peng Yu wrote: On Tue, Dec 1, 2009 at 8:24 PM, Rolf Turner wrote: On 2/12/2009, at 3:09 PM, Peng Yu wrote: Here is my sessionInfo(). [Snotty comment deleted.] sessionInfo() R version 2.7.1 (2008-06-23) If you're going to us

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 8:24 PM, Rolf Turner wrote: > > On 2/12/2009, at 3:09 PM, Peng Yu wrote: > >         > >> Here is my sessionInfo(). > >        [Snotty comment deleted.] > >>> sessionInfo() >> >> R version 2.7.1 (2008-06-23) > >         > >        If you're going to use a version which is th

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Rolf Turner
On 2/12/2009, at 3:09 PM, Peng Yu wrote: Here is my sessionInfo(). [Snotty comment deleted.] sessionInfo() R version 2.7.1 (2008-06-23) If you're going to use a version which is that antiquated then you can expect a great many things not to wor

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 8:04 PM, Jorge Ivan Velez wrote: > > I guess it depends on which version of R you are using. My sessionInfo() > follows. What's yours? > R> sessionInfo() > R version 2.10.0 Patched (2009-10-26 r50212) > i386-pc-mingw32 > locale: > [1] LC_COLLATE=English_United States.1252  L

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Jorge Ivan Velez
I guess it depends on which version of R you are using. My sessionInfo() follows. What's yours? R> sessionInfo() R version 2.10.0 Patched (2009-10-26 r50212) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United State

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 7:46 PM, Jorge Ivan Velez wrote: > Try this: > R> apropos('any') > R> ?anyDuplicated > HTH, > Jorge > > On Tue, Dec 1, 2009 at 8:32 PM, Peng Yu wrote: >> >> On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer >> wrote: >> > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Jorge Ivan Velez
Try this: R> apropos('any') R> ?anyDuplicated HTH, Jorge On Tue, Dec 1, 2009 at 8:32 PM, Peng Yu wrote: > On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer > wrote: > > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma > > wrote: > >> any(duplicated(c(1,2,2))) > > > > or > > anyDuplicated(c

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer wrote: > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma > wrote: >> any(duplicated(c(1,2,2))) > > or > anyDuplicated(c(1,2,2)) > which is slightly more efficient. I don't find anyDuplicated(). Which package is it from? ___

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Karl Ove Hufthammer
On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma wrote: > any(duplicated(c(1,2,2))) or anyDuplicated(c(1,2,2)) which is slightly more efficient. -- Karl Ove Hufthammer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Remko Duursma
any(duplicated(c(1,2,2))) r - Remko Duursma Post-Doctoral Fellow Centre for Plants and the Environment University of Western Sydney Hawkesbury Campus Richmond NSW 2753 Dept of Biological Science Macquarie University North Ryde NSW 2109 Australia

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Ista Zahn
See ?duplicated. But really I don't see anything wrong with your approach. -Ista On Mon, Nov 30, 2009 at 10:42 PM, Peng Yu wrote: > length(unique(c(1,2,2)))==length(c(1,2,2)) > > I use the above test to test if all the elements in a vector are > unique. But I'm wondering if there is a convenient

[R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Peng Yu
length(unique(c(1,2,2)))==length(c(1,2,2)) I use the above test to test if all the elements in a vector are unique. But I'm wondering if there is a convenient function to do so in R library. __ R-help@r-project.org mailing list https://stat.ethz.ch/mail