Skip to contents

This function checks if an object is considered empty based on its class.

Usage

is.empty(x)

Arguments

x

An R object

Value

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

Examples

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

# List
lst <- list()
is.empty(lst)  # Returns TRUE
#> [1] TRUE

# Data frame
df <- data.frame()
is.empty(df)  # Returns TRUE
#> [1] TRUE