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

subset

Subsetting vector-like, matrix-like and data-frame-like objects


Description

Return subsets of vector-like, matrix-like or data-frame-like objects which meet conditions.

NOTE: This man page is for the subset S4 generic function defined in the BiocGenerics package. See ?base::subset for the subset S3 generic defined in the base package.

Usage

subset(x, ...)

Arguments

x

A vector-like, matrix-like or data-frame-like object to be subsetted.

...

Additional arguments (e.g. subset, select, drop), for use in specific methods. See ?base::subset for more information.

Value

An object similar to x containing just the selected elements (for a vector-like object), or the selected rows and columns (for a matrix-like or data-frame-like object).

See Also

  • base::subset in the base package for the subset S3 generic.

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

  • selectMethod for getting the definition of a specific method.

  • subset,RectangularData-method in the S4Vectors package for an example of a specific subset method (defined for RectangularData derivatives).

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

Examples

subset
showMethods("subset")
selectMethod("subset", "ANY")  # the default method

library(S4Vectors)
showMethods("subset")
## The subset() method for RectangularData derivatives:
selectMethod("subset", "RectangularData")

BiocGenerics

S4 generic functions used in Bioconductor

v0.36.1
Artistic-2.0
Authors
The Bioconductor Dev Team
Initial release

We don't support your browser anymore

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