`maximum`, `minimum`, etc, with array with missing values

Shouldn’t these functions return the maximum, minimum, etc, disregarding missing values?

julia> x = [ missing, 1, 2 ]
3-element Array{Union{Missing, Int64},1}:
  missing
 1
 2

julia> maximum(x)
missing

julia> minimum(x)
missing

julia> using Statistics

julia> mean(x)
missing

julia> std(x)
missing


2 Likes

You should use skipmissing here. For missing values, it is assumed they could represent any value possible, so operations like the maximum propagate this uncertainty.

10 Likes