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 use a version which is that antiquated
   then you can expect a great many things not to work.

   Version 2.10.1 is about to be released, for crying out loud!


Are are package installations backward compatible?


Mostly.

Will R code that works in order installations work in the new  
installations?


Mostly.

R-core go to a great deal of effort to make new releases backward
compatible and to make sure that old code doesn't get broken.
Sometimes, however, there's just no help for it, and things get
broken.  Usually there are plenty of warnings in the ``news'',
and the breaks can of course always be fixed.  This is R, after all.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
[email protected] mailing list
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] 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 that antiquated
>        then you can expect a great many things not to work.
>
>        Version 2.10.1 is about to be released, for crying out loud!

Are are package installations backward compatible? Will R code that
works in order installations work in the new installations?

__
[email protected] mailing list
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] 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 work.

Version 2.10.1 is about to be released, for crying out loud!

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
[email protected] mailing list
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] 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  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  wrote:
>>
>> 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
>> >> > 
>> >> > 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

__
[email protected] mailing list
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] 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 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  wrote:

> 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 <
> [email protected]>
> >> > 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")'
>
> __
> [email protected] mailing list
> 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.
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
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] 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 
>> > 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")'

__
[email protected] mailing list
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] 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(1,2,2))
> > which is slightly more efficient.
>
> I don't find anyDuplicated(). Which package is it from?
>
> __
> [email protected] mailing list
> 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.
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
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] 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?

__
[email protected] mailing list
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] 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

__
[email protected] mailing list
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] 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

Mobile: +61 (0)422 096908
www.remkoduursma.com



On Tue, Dec 1, 2009 at 2: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 function to do so
> in R library.
>
> __
> [email protected] mailing list
> 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.
>

__
[email protected] mailing list
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] 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 function to do so
> in R library.
>
> __
> [email protected] mailing list
> 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

__
[email protected] mailing list
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.