subset-methods {Cardinal} | R Documentation

## Subsetting

### Description

Returns a subset of the dataset that meets the conditions.

### Usage

    ## S4 method for signature 'SparseImagingExperiment'
    subset(x, subset, select, ...)

    subsetFeatures(x, ...)

    subsetPixels(x, ...)

### Arguments

`x` | An imaging dataset.
`subset` | Logical expression to be evaluated in the object's `featureData()` indicating which rows (features) to keep.
`select` | Logical expression to be evaluated in the object's `pixelData()` indicating which columns (pixels) to keep.
`...` | Conditions describing rows (features) or columns (pixels) to be retained. Passed to `features()` and `pixels()` methods to obtain the subset indices.

### Value

An object of the same class as `x` with the appropriate subsetting applied to it.

### Author(s)

Kylie A. Bemis

### Examples

    set.seed(1)
    mse <- simulateImage(preset=1, npeaks=10, dim=c(10,10))

    # subset features to mass range 1000 - 1500
    subsetFeatures(mse, 1000 < mz, mz < 1500)

    # select pixels to coordinates x = 1..3, y = 1..3
    subsetPixels(mse, x <= 3, y <= 3)

    # subset both features + pixels
    subset(mse, 1000 < mz & mz < 1500, x <= 3 & y <= 3)

[Package Cardinal version 2.8.0 Index]