Skip to contents

This function checks if a matrix has zero rows or zero columns.

Usage

# S3 method for matrix
is.empty(x)

Arguments

x

A matrix object

Value

A logical value: TRUE if the matrix is empty, FALSE otherwise

Examples

mat1 <- matrix(nrow = 0, ncol = 5)
is.empty(mat1)  # Returns TRUE
#> [1] TRUE

mat2 <- matrix(1:6, nrow = 2)
is.empty(mat2)  # Returns FALSE
#> [1] FALSE