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

Ista Zahn istazahn at gmail.com
Tue Dec 1 04:47:26 CET 2009


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 <pengyu.ut at gmail.com> 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.
>
> ______________________________________________
> R-help at r-project.org 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




More information about the R-help mailing list