powered by
Removes elements from a vector or list that are considered "void": NA, NULL, and empty strings (`"""). Each can be toggled via parameters.
NA
NULL
drop_void(x, include_na = TRUE, include_null = TRUE, include_empty_str = TRUE)
A cleaned vector or list of the same type as input, with void values removed.
A vector or list.
Logical. Remove NA if TRUE. Default: TRUE.
Logical. Remove NULL if TRUE. Default: TRUE.
Logical. Remove "" if TRUE. Default: TRUE.
""
drop_void(c("apple", "", NA, "banana")) drop_void(list("A", NA, "", NULL, "B")) drop_void(c("", NA), include_na = FALSE)
Run the code above in your browser using DataLab