Skip to contents

Subset object to keep only non-zero rows and columns

Usage

nonzeroRowsAndCols(object, ...)

# S4 method for Matrix
nonzeroRowsAndCols(object, quiet = FALSE)

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

# S4 method for matrix
nonzeroRowsAndCols(object, quiet = FALSE)

Arguments

object

Object.

quiet

logical(1). Perform command quietly, suppressing messages.

assay

vector(1). Assay name or index position.

...

Additional arguments.

Value

Modified object.

Note

Updated 2021-02-02.

Examples

data(RangedSummarizedExperiment, package = "AcidTest")

## SummarizedExperiment ====
object <- RangedSummarizedExperiment
dim(object)
#> [1] 500  12
x <- nonzeroRowsAndCols(object)
#>  Filtered zero count rows and columns:
#> - 499 / 500 rows (100%)
#> - 12 / 12 columns (100%)
dim(x)
#> [1] 499  12