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

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/anyMissing.R

Description

Checks if there are any missing values in an object or not. Please use base::anyNA() instead of anyMissing(), colAnyNAs() instead of colAnyMissings(), and rowAnyNAs() instead of rowAnyMissings().

Usage

1
2
3
4
5
6
7
8
9
anyMissing(x, idxs = NULL, ...)

colAnyMissings(x, rows = NULL, cols = NULL, ..., useNames = NA)

rowAnyMissings(x, rows = NULL, cols = NULL, ..., useNames = NA)

colAnyNAs(x, rows = NULL, cols = NULL, ..., useNames = NA)

rowAnyNAs(x, rows = NULL, cols = NULL, ..., useNames = NA)

Arguments

x

A vector, a list, a matrix, a data.frame, or NULL.

idxs

A vector indicating subset of elements to operate over. If NULL, no subsetting is done.

...

Not used.

rows

A vector indicating subset of rows to operate over. If NULL, no subsetting is done.

cols

A vector indicating subset of columns to operate over. If NULL, no subsetting is done.

useNames

If NA, the default behavior of the function about naming support is remained. If FALSE, no naming support is done. Else if TRUE, names attributes of result are set.

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.

Value

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

Author(s)

Henrik Bengtsson

See Also

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

Examples

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

matrixStats documentation built on Sept. 17, 2021, 5:06 p.m.