Check if all values in a vector are NA.

all_na(x)

Arguments

x

A vector or data frame.

Value

Logical, TRUE if x has only NA values, FALSE if x has at least one non-missing value.

Examples

x <- c(NA, NA, NA)
y <- c(1, NA, NA)

all_na(x)
#> [1] TRUE
all_na(y)
#> [1] FALSE
all_na(data.frame(x, y))
#>      x     y
#> 1 TRUE FALSE
all_na(list(x, y))
#> [[1]]
#> [1] TRUE
#> 
#> [[2]]
#> [1] FALSE
#>