all_na {na.tools} | R Documentation |
Test if all values are missing
all_na(x) ## Default S3 method: all_na(x) any_na(x) is_na() which_na(x)
x |
object to test. |
These are S3 Generics that provide default methods.
all_na
reports if all values are missing.
any_na
reports if any values are missing. If always returns a logical
scalar.
is_na
is a wrapper around base::is.na()
created to keep stylistic
consistenct with the other functions.
which_na
is implemented as which( is.na(x) )
.
It is a S3 generic function.
logical scalar indicating if values are missing.
logical scalar; either TRUE or FALSE.
integer
of indexes of x
that corerspond to elements
of x that are missing (NA
). Names of the result
are set to the names of x
.
base::is.na()
- for the variant returning logical
all_na( c( NA, NA, 1 ) ) # FALSE all_na( c( NA, NA, NA ) ) # TRUE df <- data.frame( char = rep(NA_character_, 3), nums=1:3) all_na(df) # FALSE df <- data.frame( char = rep(NA_character_, 3), nums=rep(NA_real_,3)) all_na(df) # TRUE any_na( 1:10 ) # FALSE any_na( c( 1, NA, 3 ) ) # TRUE x <- c( 1, NA, NA, 4:6 ) which_na(x) names(x) <- letters[1:6] which_na(x)