Skip to contents

This function checks if a vector has length zero.

Usage

# S3 method for vector
is.empty(x)

Arguments

x

A vector object

Value

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

Examples

vec1 <- numeric(0)
is.empty(vec1)  # Returns TRUE
#> Error in is.empty.default(vec1): is.empty is not defined for objects of class numeric

vec2 <- c(1, 2, 3)
is.empty(vec2)  # Returns FALSE
#> Error in is.empty.default(vec2): is.empty is not defined for objects of class numeric