View source: R/nonAmbiguousNum.R
nonAmbiguousNum | R Documentation |
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
)
x |
(numeric) main input |
uniqOnly |
(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 |
asList |
(logical) return list |
nameMod |
(character) text to add in case on ambiguous values, default="amb_" |
callFrom |
(character) allow easier tracking of message(s) produced |
sorted non-ambigous numeric vector (or list if 'asList'=TRUE and 'uniqOnly'=FALSE)
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.