Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

treatTxtDuplicates

Locate duplicates in text and make non-redundant


Description

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

Usage

treatTxtDuplicates(
  x,
  atEnd = TRUE,
  sep = "_",
  onlyCorrectToUnique = FALSE,
  silent = FALSE,
  callFrom = NULL
)

Arguments

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 correctToUnique)

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

Value

list with $init, $nRed, $nrLst

See Also

For simple correction use correctToUnique

Examples

treatTxtDuplicates(c("li0",NA,rep(c("li2","li3"),2)))
correctToUnique(c("li0",NA,rep(c("li2","li3"),2)))

wrMisc

Analyze Experimental High-Throughput (Omics) Data

v1.5.4
GPL-3
Authors
Wolfgang Raffelsberger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.