another option is rlang::is_empty
(useful if you're working in the tidyverse)
The rlang namespace does not seem to be attached when attaching the tidyverse via library(tidyverse)
- in this case you use purrr::is_empty
, which is just imported from the rlang
package.
By the way, rlang::is_empty
uses user Gavin's approach.
rlang::is_empty(which(1:3 == 5))
#> [1] TRUE