all_na: (Internal) Find Rows or Columns with Only NAs Over Array...

Description Usage Arguments See Also Examples

Description

all_na returns a logical vector or array or list indicating whether there are only NA values in selected margins and therefore e.g. statistics like max or min do not produce useful results.

Usage

1
all_na(x, margin)

Arguments

x

An array, including a matrix.

margin

A vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where x has named dimnames, it can be a character vector selecting dimension names.

See Also

NA for general information about NAs and apply for apply description.

Examples

1
2
3
4
5
6
xx <- matrix(1:20, nrow = 4)
xx[2, ] <- NA
all_na(xx, 2)  # All columns have at least one non-missing value
all_na(xx, 1)  # Second row has all values missing
## Skip the all_na row in apply()
apply(xx[!all_na(xx, 1), ], 1, max, na.rm = TRUE)

grahamstewart12/tidyflux documentation built on June 4, 2019, 7:44 a.m.