Locate duplicates in text and make non-redundant
treatTxtDuplicates
locates duplictes in character-vector 'x' and return list (length=3) : with $init (initial),
$nRed .. non-redundant text by adding number at end or beginning, and $nrLst .. list-version with indexes per unique entry.
Note : NAs (if multiple) will be renamed to NA_1, NA_2
treatTxtDuplicates( x, atEnd = TRUE, sep = "_", onlyCorrectToUnique = FALSE, silent = FALSE, callFrom = NULL )
x |
(character) vector with character-entries to identify (and remove) duplicates |
atEnd |
(logical) decide location of placing the counter (at end or at beginning of ID) (see |
sep |
(character) separator to add before counter when making non-redundant version |
onlyCorrectToUnique |
(logical) if TRUE, return only vector of non-redundant |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of message(s) produced |
list with $init, $nRed, $nrLst
For simple correction use correctToUnique
treatTxtDuplicates(c("li0",NA,rep(c("li2","li3"),2))) correctToUnique(c("li0",NA,rep(c("li2","li3"),2)))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.