Skip to content

Allow function as first argument of median #141

Closed
@KronosTheLate

Description

@KronosTheLate

See this asymmerty:

julia> using Statistics

julia> v = randn(10);

julia> mean(abs, v)
0.6470633745357454

julia> median(abs, v)
ERROR: MethodError: no method matching median(::typeof(abs), ::Vector{Float64})
Closest candidates are:
  median(::Any) at ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/Statistics/src/Statistics.jl:855
Stacktrace:
 [1] top-level scope
   @ REPL[6]:1

Is there any reason for it? If not, a method for median should be added that takes a function as the first argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions