A Reversable Version of unique()
A version of unique
keeping enough information to
reverse (or invert) to the original data.
uniqueL(x, isuniq = !duplicated(x), need.sort = is.unsorted(x))
x |
numeric vector, of length |
isuniq |
logical vector of the same length as |
need.sort |
logical indicating if |
list of two components,
ix |
integer vector of indices |
xU |
vector of values from |
such that both x[isuniq] === xU
and xU[ix] === x
.
Martin Maechler
Duplicated
from the sfsmisc package in
addition to the standard unique
and
duplicated
.
x0 <- c(1:3,2:7,8:4) str(r0 <- uniqueL(x0)) with(r0, xU[ix]) ## == x0 !
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.