Hello,
Try
i <- !(duplicated(Dup) | duplicated(Dup, fromLast = TRUE))
Dup[i]
or in one line, I post it like this to make it more clear.
Hope this helps,
Rui Barradas
Às 14:41 de 19/11/2018, Knut Krueger escreveu:
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@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.
______________________________________________
R-help@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.