duplicated {BiocGenerics} | R Documentation |
Determine duplicate elements
Description
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.
Usage
duplicated(x, incomparables=FALSE, ...)
anyDuplicated(x, incomparables=FALSE, ...)
Arguments
x |
A vector-like or data-frame-like object. |
incomparables , ... |
See |
Value
The default duplicated
method (see
?base::duplicated
) returns a logical vector
of length N where N is:
-
length(x)
whenx
is a vector; -
nrow(x)
whenx
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 defaultduplicated
andanyDuplicated
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.
Examples
duplicated
showMethods("duplicated")
selectMethod("duplicated", "ANY") # the default method
anyDuplicated
showMethods("anyDuplicated")
selectMethod("anyDuplicated", "ANY") # the default method