subsetSCECols {singleCellTK} | R Documentation

## Subset a SingleCellExperiment object by columns

### Description

Used to peform subsetting of a SingleCellExperiment object using a variety of methods that indicate the correct columns to keep. The various methods, `index`, `bool`, and `colData`, can be used in conjunction with one another.

### Usage

    subsetSCECols(inSCE, index = NULL, bool = NULL, colData = NULL)

### Arguments

`inSCE` | Input SingleCellExperiment object.
`index` | Integer vector. Vector of indicies indicating which columns to keep. If `NULL`, this will not be used for subsetting. Default `NULL`.
`bool` | Boolean vector. Vector of `TRUE` or `FALSE` indicating which columns should be kept. Needs to be the same length as the number of columns in `inSCE`. If `NULL`, this will not be used for subsetting. Default `NULL`.
`colData` | Character. An expression that will identify a subset of columns using variables found in the `colData` of `inSCE`. For example, if `x` is a numeric vector in `colData`, then `"x < 5"` will return all columns with x less than 5. Single quotes should be used for character strings. For example, `"y == 'yes'"` will return all columns where y is "yes". Multiple expressions can be evaluated by placing them in a vector. For example `c("x < 5", "y =='yes'")` will apply both operations for subsetting. If `NULL`, this will not be used for subsetting. Default `NULL`.

### Value

A SingleCellExperiment object that has been subsetted by colData.

### Author(s)

Joshua D. Campbell

### Examples

    data(scExample)
    sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'")

[Package singleCellTK version 2.0.0 Index]