I know there is the function unique()
that extracts the unique values from a vector. But I lose its name.
Ex.
vector = c("A" = 1, "B" = 2, "A" = 1, "C" = 3, "B" = 2, "D" = 3, "D" = 3)
If I print I should see:
A B A C B D D
1 2 1 3 2 3 3
Expected output:
A B C D
1 2 3 3
Attempts:
If I use: unique(vector)
I only get 1 2 3
If I use: vector[!duplicated(vector)]
I get:
A B C
1 2 3
This is close, but the "D" = 3
is missing.