Learn R Programming

wrMisc (version 2.1.1)

findRepeated: Find Repeated Elements

Description

This function gets index of repeated items/values in vector 'x' (will be treated as character). It returns (named) list of indexes for each of the repeated values, or NULL if all values are unique. This approach is similar but more basic compared to get1stOfRepeatedByCol.

Usage

findRepeated(
  x,
  nonRepeated = FALSE,
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Value

This function returns a (named) list of indexes for each of the repeated values, or NULL if all values unique

Arguments

x

character vector

nonRepeated

(logical) if nonRepeated=TRUE return list with elements $rep and $nonrep

silent

(logical) suppress messages

debug

(logical) additional messages for debugging

callFrom

(character) allow easier tracking of messages produced

See Also

similar approach but more basic than get1stOfRepeatedByCol

Examples

Run this code
aa <- c(11:16,14:12,14); findRepeated(aa) 

Run the code above in your browser using DataLab