1
- using Compat . Statistics
1
+ import StatsBase
2
2
3
3
function fill_refs! (refs:: AbstractArray , X:: AbstractArray ,
4
4
breaks:: AbstractVector , extend:: Bool , allow_missing:: Bool )
@@ -133,12 +133,17 @@ function cut(x::AbstractArray{T, N}, breaks::AbstractVector;
133
133
end
134
134
135
135
"""
136
- cut(x::AbstractArray, ngroups::Integer;
136
+ cut(x::AbstractArray, [w::AbstractWeights, ] ngroups::Integer;
137
137
labels::Union{AbstractVector{<:AbstractString},Function})
138
138
139
139
Cut a numeric array into `ngroups` quantiles, determined using
140
140
[`quantile`](@ref).
141
141
"""
142
142
cut (x:: AbstractArray , ngroups:: Integer ;
143
143
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