unique: Extract unique elements

Description Usage Arguments Value See Also Examples


unique returns an object of the same class as x (typically a vector-like, data-frame-like, or array-like object) but with duplicate elements/rows removed.

NOTE: This man page is for the unique S4 generic function defined in the BiocGenerics package. See ?base::unique for the default method (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.


unique(x, incomparables=FALSE, ...)



A vector-like, data-frame-like, or array-like object.

incomparables, ...

See ?base::unique for a description of these arguments.


See ?base::unique for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

unique should always behave consistently with BiocGenerics::duplicated.

See Also

  • base::unique for the default unique method.

  • BiocGenerics::duplicated for determining duplicate elements.

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

  • selectMethod for getting the definition of a specific method.

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

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


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

Search within the BiocGenerics package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.