BiocGenerics (version 0.18.0)

duplicated: Determine duplicate elements


Determines which elements of a vector-like or data-frame-like object are duplicates of elements with smaller subscripts, and returns a logical vector indicating which elements (rows) are duplicates.

NOTE: This man page is for the duplicated and anyDuplicated S4 generic functions defined in the BiocGenerics package. See ?base::duplicated for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like or data-frame-like) not supported by the default method.


duplicated(x, incomparables=FALSE, ...) anyDuplicated(x, incomparables=FALSE, ...)


A vector-like or data-frame-like object.
incomparables, ...
See ?base::duplicated for a description of these arguments.


The default duplicated method (see ?base::duplicated) returns a logical vector of length N where N is:
  • length(x) when x is a vector;
  • nrow(x) when x is a data frame.
Specific duplicated methods defined in Bioconductor packages must also return a logical vector of the same length as x when x is a vector-like object, and a logical vector with one element for each row when x is a data-frame-like object.The default anyDuplicated method (see ?base::duplicated) returns a single non-negative integer and so must the specific anyDuplicated methods defined in Bioconductor packages.anyDuplicated should always behave consistently with duplicated.

See Also

  • base::duplicated for the default duplicated and anyDuplicated methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • duplicated,Rle-method in the S4Vectors package for an example of a specific duplicated method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.


Run this code
selectMethod("duplicated", "ANY")  # the default method

selectMethod("anyDuplicated", "ANY")  # the default method

Run the code above in your browser using DataLab