Dear Knut, Here's one way:
as.vector((table(Dup) > 1)[Dup])
[1] TRUE TRUE TRUE FALSE TRUE TRUE TRUE FALSE Someone will probably think of something cleverer. I hope this helps, John -------------------------------------- John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada Web: socialsciences.mcmaster.ca/jfox/
-----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Knut Krueger Sent: Monday, November 19, 2018 9:42 AM To: r-help at r-project.org >> r-help mailing list <r-help at r-project.org> Subject: [R] unique() duplicate() not what i am looking for It should be simple but i do not find the right keywords: Dup = c(1,2,3,4,1,2,3,5) I need 4,5 as result unique(Dup) gives me [1] 4 1 2 3 5 duplicated(Dup) gives me [1] FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE I need [1] TRUE TRUE TRUE FALSE TRUE TRUE TRUE FALSE Kind regards Knut
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.