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

Peng Yu pengyu.ut at gmail.com
Wed Dec 2 03:09:54 CET 2009


On Tue, Dec 1, 2009 at 8:04 PM, Jorge Ivan Velez
<jorgeivanvelez at gmail.com> 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  LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
>
> [5] LC_TIME=English_United States.1252
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> loaded via a namespace (and not attached):
> [1] tools_2.10.0
> HTH,
> Jorge
> On Tue, Dec 1, 2009 at 8:57 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>>
>> On Tue, Dec 1, 2009 at 7:46 PM, Jorge Ivan Velez
>> <jorgeivanvelez at gmail.com> wrote:
>> > Try this:
>> > R> apropos('any')
>> > R> ?anyDuplicated
>> > HTH,
>> > Jorge
>> >
>> > On Tue, Dec 1, 2009 at 8:32 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>> >>
>> >> On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer <karl at huftis.org>
>> >> wrote:
>> >> > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma
>> >> > <remkoduursma at gmail.com>
>> >> > 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?
>>
>> Here are what I got.
>>
>> > apropos('any')
>> [1] "any"          "argsAnywhere" ".__C__ANY"    "getAnywhere"
>> > ?anyDuplicated
>> No documentation for 'anyDuplicated' in specified packages and libraries:
>> you could try 'help.search("anyDuplicated")'


Here is my sessionInfo(). BTW, it is generally not a good idea to top
post in mailing list or newsgroup, because it breaks the message flow.

> sessionInfo()
R version 2.7.1 (2008-06-23)
x86_64-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base




More information about the R-help mailing list