Subset object to keep only non-zero rows and columns

nonzeroRowsAndCols(object, ...)

# S4 method for matrix
nonzeroRowsAndCols(object)

# S4 method for Matrix
nonzeroRowsAndCols(object)

# S4 method for SummarizedExperiment
nonzeroRowsAndCols(object, assay = 1L)

Arguments

object

Object.

assay

vector(1). Assay name or index position.

...

Additional arguments.

Value

Modified object.

Note

Updated 2019-10-09.

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) ## SummarizedExperiment ==== object <- RangedSummarizedExperiment dim(object)
#> [1] 500 12
x <- nonzeroRowsAndCols(object) dim(x)
#> [1] 500 12
## SingleCellExperiment ==== object <- SingleCellExperiment dim(object)
#> [1] 500 100
x <- nonzeroRowsAndCols(object)
#> Filtered zero count rows and columns: #> - 485 / 500 rows (97.0%) #> - 100 / 100 columns (100%)
dim(x)
#> [1] 485 100