Determine whether input values are considered "void": NULL
, NA
, or ""
.
Each condition is controlled by a dedicated argument.
Usage
is_void(x, include_na = TRUE, include_null = TRUE, include_empty_str = TRUE)
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.
Value
A logical vector indicating which elements are void.
Examples
is_void(c(NA, "", "text")) # TRUE TRUE FALSE
#> [1] TRUE TRUE FALSE
is_void(list(NA, "", NULL, "a")) # TRUE TRUE TRUE FALSE
#> [1] TRUE TRUE TRUE FALSE
is_void("NA", include_na = FALSE) # FALSE
#> [1] FALSE
is_void(NULL) # TRUE
#> [1] TRUE