1- using Compat . Statistics
1+ import StatsBase
22
33function fill_refs! (refs:: AbstractArray , X:: AbstractArray ,
44 breaks:: AbstractVector , extend:: Bool , allow_missing:: Bool )
@@ -133,12 +133,17 @@ function cut(x::AbstractArray{T, N}, breaks::AbstractVector;
133133end
134134
135135"""
136- cut(x::AbstractArray, ngroups::Integer;
136+ cut(x::AbstractArray, [w::AbstractWeights, ] ngroups::Integer;
137137 labels::Union{AbstractVector{<:AbstractString},Function})
138138
139139Cut a numeric array into `ngroups` quantiles, determined using
140140[`quantile`](@ref).
141141"""
142142cut (x:: AbstractArray , ngroups:: Integer ;
143143 labels:: Union{AbstractVector{<:AbstractString},Function} = default_formatter) =
144- cut (x, Statistics. quantile (x, (1 : ngroups- 1 )/ ngroups); extend= true , labels= labels)
144+ cut (x, StatsBase. quantile (x, (1 : ngroups- 1 )/ ngroups); extend= true , labels= labels)
145+
146+ cut (x:: AbstractArray , w:: AbstractWeights , ngroups:: Integer ;
147+ labels:: Union{AbstractVector{<:AbstractString},Function} = default_formatter) =
148+ cut (x, StatsBase. quantile (x, w, (1 : ngroups- 1 )/ ngroups); extend= true , labels= labels)
149+
0 commit comments