An equivalent of a subset function for flowFrame or a flowSet object. Alternatively, the regular subsetting operators can be used for most of the topics documented here.

Subset(x, subset, ...)

Arguments

x

The flow object, frame or set, to subset.

subset

A filter object or, in the case of flowSet subsetting, a named list of filters.

...

Like the original subset function, you can also select columns.

Value

Depending on the original context, either a flowFrame or a flowSet.

Details

The Subset method is the recommended method for obtaining a flowFrame that only contains events consistent with a particular filter. It is functionally equivalent to frame[as(filter(frame,subset),"logical"),] when used in the flowFrame context. Used in the flowSet context, it is equivalent to using fsApply to apply the filtering operation to each flowFrame.

Additionally, using Subset on a flowSet can also take a named list as the subset. In this case, the names of the list object should correspond to the sampleNames of the flowSet, allowing a different filter to be applied to each frame. If not all of the names are used or excess names are present, a warning will be generated but the valid filters will be applied for the rare instances where this is the intended operation. Note that a filter operation will generate a list of filterResult objects that can be used directly with Subset in this manner.

See also

Examples

sample <- read.flowSet(path=system.file("extdata", package="flowCore"), pattern="0877408774") result <- filter(sample, rectangleGate("FSC-H"=c(-Inf, 1024))) result
#> A list of filterResults for a flowSet containing 3 frames #> produced by the filter named 'defaultRectangleGate'
Subset(sample,result)
#> A flowSet with 3 experiments. #> #> column names: #> FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A FL4-H Time