nonAmbiguousNum
makes (named) values of numeric vector 'x' unique.
Note: for non-numeric use firstOfRepeated
- but 1000x slower !
Return sorted non-ambigous numeric vector (or list if 'asList'=TRUE and 'uniqOnly'=FASLSE)
nonAmbiguousNum(
x,
uniqOnly = FALSE,
asList = FALSE,
nameMod = "amb_",
callFrom = NULL
)
sorted non-ambigous numeric vector (or list if 'asList'=TRUE and 'uniqOnly'=FALSE)
(numeric) main input
(logical) if=TRUE return unique only, if =FALSE return unique and single representative of non-unique values (with '' added to name), selection of representative of repeated: first (of sorted) or middle if >2 instances
(logical) return list
(character) text to add in case on ambiguous values, default="amb_"
(character) allow easier tracking of message(s) produced
firstOfRepeated
for non-numeric use (much slower !!!), duplicated
set.seed(2017); aa <- round(rnorm(100),2); names(aa) <- 1:length(aa)
str(nonAmbiguousNum(aa))
str(nonAmbiguousNum(aa,uniq=FALSE,asLi=TRUE))
Run the code above in your browser using DataLab