Skip to contents

median_is_determinate() tests whether a vector's median can be determined despite missing values. It is based on median2().

Usage

median_is_determinate(x, na.rm.amount = 0)

Arguments

x

Numeric or similar. Vector to search for its median.

na.rm.amount

Numeric. Alternative to na.rm that only removes a specified number of missing values. Default is 0.

Value

Logical (length 1).

Examples

# The median is 1, no matter which number
# `NA` represents:
median_is_determinate(c(1, 1, NA))
#> [1] FALSE

# Here, the median may be 1 or 2, depending
# on the value behind `NA`; so the median
# cannot be determined:
median_is_determinate(c(1, 2, NA))
#> [1] FALSE