all_na {na.tools} | R Documentation |
Tests for missing values
Description
Test if all values are missing
Usage
all_na(x)
## Default S3 method:
all_na(x)
any_na(x)
is_na()
which_na(x)
Arguments
x |
object to test. |
Details
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.
Value
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
.
See Also
-
base::is.na()
- for the variant returning logical
Examples
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)
[Package na.tools version 0.3.1 Index]