check-scalar-hasNonzeroRowsAndCols: Does the input contain non-zero rows and columns?

check-scalar-hasNonzeroRowsAndColsR Documentation

Does the input contain non-zero rows and columns?

Description

Useful for quickly checking to see if we have dropped rows or columns containing all zeros.

Usage

hasNonzeroRowsAndCols(x)

Arguments

x

Object.

Details

This is a common check when handling RNA-seq data prior to generating a heatmap or applying a log transformation, for example.

Value

TRUE on success; FALSE on failure, with cause set.

Note

Updated 2021-01-04.

Examples

## TRUE ====
x <- matrix(data = seq_len(4L), nrow = 2L)
print(x)
hasNonzeroRowsAndCols(x)

## FALSE ====
x <- matrix(data = rep(c(0L, 1L), times = 2L), nrow = 2L, byrow = FALSE)
print(x)
hasNonzeroRowsAndCols(x)

x <- matrix(data = rep(c(0L, 1L), times = 2L), nrow = 2L, byrow = TRUE)
print(x)
hasNonzeroRowsAndCols(x)

acidgenomics/goalie documentation built on Dec. 11, 2023, 11:36 p.m.