max_mis: A function to safely take the maximum of a vector that could...

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

View source: R/max_mis.R

Description

When computing the maximum on arbitrary subsets of data, some of which may only have missing values, it may be necessary to take the maximum of a vector of NAs. This replaces the behavior that returns Inf or-Inf and replaces it with simply returning an NA.

Usage

1

Arguments

x

A vector of data that a maximum can be taken of.

Details

This function only returns valid results for vectors with a mix of NA and numeric values.

Value

A vector with the maximum value or with an NA of the proper type

Author(s)

Jared E. Knowles

See Also

See also max which this function wraps.

Examples

1
2
3
4
max(c(7,NA,3,2,0),na.rm=TRUE)
max_mis(c(7,NA,3,2,0))
max(c(NA,NA,NA,NA),na.rm=TRUE)
max_mis(c(NA,NA,NA,NA))

eeptools documentation built on May 3, 2020, 1:05 a.m.