Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


matrixStats (version 0.51.0)

anyMissing: Checks if there are any missing values in an object or not

Description

Checks if there are any missing values in an object or not.

Usage

anyMissing(x, idxs=NULL, ...)
 colAnyMissings(x, rows=NULL, cols=NULL, ...)
 rowAnyMissings(x, rows=NULL, cols=NULL, ...)

Arguments

x
A vector, a list, a matrix, a data.frame, or NULL.
idxs, rows, cols
A vector indicating subset of elements (or rows and/or columns) to operate over. If NULL, no subsetting is done.
...
Not used.

Value

Returns TRUE if a missing value was detected, otherwise FALSE.

Details

The implementation of this method is optimized for both speed and memory. The method will return TRUE as soon as a missing value is detected.

See Also

Starting with R v3.1.0, there is anyNA() in the base, which provides the same functionality as anyMissing().

Examples

Run this code
 x <- rnorm(n=1000)
 x[seq(300,length(x),by=100)] <- NA
 stopifnot(anyMissing(x) == any(is.na(x)))

Run the code above in your browser using DataLab