[R] selecting values that are unique, instead of selecting unique values
Marc Schwartz
marc_schwartz at comcast.net
Wed Jun 25 18:49:56 CEST 2008
on 06/25/2008 11:44 AM Gabor Csardi wrote:
> I'm sorry to say, but this one is wrong, too.
> Maybe coffee really helps, I just had one. :)
>
>> Vec <- c(20:30,20)
>> which(table(Vec) == 1)
> 21 22 23 24 25 26 27 28 29 30
> 2 3 4 5 6 7 8 9 10 11
>
> You would actually need the names, but that would involve
> some numberic -> character -> numeric conversion.
> My previous solution is better in this respect.
>
> Btw. to get rid of names 'unname' is better, the code is
> more readable.
>
> Best,
> Gabor
OK....forget the coffee....I'm just going back to bed. :-)
The movie 'Ground Hog Day' comes to mind...
Wow. My bad.
Thanks,
Marc
More information about the R-help
mailing list