subset: Subsetting vector-like, matrix-like and data-frame-like...

Description Usage Arguments Value See Also Examples

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

1
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

Examples

1
2
3
4
5
6
7
8
subset
showMethods("subset")
selectMethod("subset", "ANY")  # the default method

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

Example output

Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

standardGeneric for "subset" defined from package "base"

function (x, ...) 
standardGeneric("subset")
<environment: 0x564bc5ca66e8>
Methods may be defined for arguments: x
Use  showMethods("subset")  for currently available ones.
Function: subset (package base)
x="ANY"

Method Definition (Class "derivedDefaultMethod"):

function (x, ...) 
UseMethod("subset")
<bytecode: 0x564bc46652b8>
<environment: namespace:base>

Signatures:
        x    
target  "ANY"
defined "ANY"
Loading required package: stats4

Attaching package:S4VectorsThe following object is masked frompackage:base:

    expand.grid

Function: subset (package base)
x="ANY"
x="RectangularData"
x="Vector"

Method Definition:

function (x, ...) 
{
    .local <- function (x, subset, select, drop = FALSE, ...) 
    {
        i <- evalqForSubset(subset, x, ...)
        j <- evalqForSelect(select, x, ...)
        x[i, j, drop = drop]
    }
    .local(x, ...)
}
<bytecode: 0x564bc8391a88>
<environment: namespace:S4Vectors>

Signatures:
        x                
target  "RectangularData"
defined "RectangularData"

BiocGenerics documentation built on April 17, 2021, 6:01 p.m.