[R] selecting values that are unique, instead of selecting unique values

Gabor Grothendieck ggrothendieck at gmail.com
Wed Jun 25 18:50:26 CEST 2008


On Wed, Jun 25, 2008 at 12:19 PM, Daren Tan <daren76 at hotmail.com> wrote:
>
>
> unique(c(1:10,1)) gives 1:10 (i.e. unique values), is there any method to get only 2:10 (i.e. values that are unique) ?
>
>

Try this:

setdiff(x, x[duplicated(x)])



More information about the R-help mailing list