Learn R Programming

evanverse (version 0.3.7)

any_void: any_void(): Check if Any Value is Void (NA / NULL / "")

Description

Test whether any element in a vector or list is considered "void". Void values include NA, NULL, and empty strings (""), and you can customize which ones to consider.

Usage

any_void(x, include_na = TRUE, include_null = TRUE, include_empty_str = TRUE)

Value

A single logical value:

  • TRUE if any void values are present.

  • FALSE otherwise.

  • For NULL input, returns TRUE if include_null = TRUE, else FALSE.

Arguments

x

A vector or list to evaluate.

include_na

Logical. Consider NA as void. Default: TRUE.

include_null

Logical. Consider NULL as void. Default: TRUE.

include_empty_str

Logical. Consider "" as void. Default: TRUE.

Examples

Run this code
any_void(c("a", "", NA))                # TRUE
any_void(list("x", NULL, "y"))          # TRUE
any_void(c("a", "b", "c"))              # FALSE
any_void(NULL)                          # TRUE
any_void("", include_empty_str = FALSE) # FALSE

Run the code above in your browser using DataLab