@@ -99,9 +99,9 @@ Equivalent to `counts(x, levels) / length(x)`.
99
99
If a vector of weights `wv` is provided, the proportion of weights is computed rather
100
100
than the proportion of raw counts.
101
101
"""
102
- proportions (x:: AbstractArray{<:Integer} , levels:: UnitRange{<:Integer} ) = counts (x, levels) .* inv ( length (x) )
102
+ proportions (x:: AbstractArray{<:Integer} , levels:: UnitRange{<:Integer} ) = counts (x, levels) / length (x)
103
103
proportions (x:: AbstractArray{<:Integer} , levels:: UnitRange{<:Integer} , wv:: AbstractWeights ) =
104
- counts (x, levels, wv) .* inv ( sum (wv) )
104
+ counts (x, levels, wv) / sum (wv)
105
105
106
106
"""
107
107
proportions(x, k::Integer, [wv::AbstractWeights])
@@ -204,9 +204,9 @@ counts(x::AbstractArray{<:Integer}, y::AbstractArray{<:Integer}) = counts(x, y,
204
204
counts (x:: AbstractArray{<:Integer} , y:: AbstractArray{<:Integer} , wv:: AbstractWeights ) = counts (x, y, (span (x), span (y)), wv)
205
205
206
206
proportions (x:: AbstractArray{<:Integer} , y:: AbstractArray{<:Integer} , levels:: NTuple{2,UnitRange{<:Integer}} ) =
207
- counts (x, y, levels) .* inv ( length (x) )
207
+ counts (x, y, levels) / length (x)
208
208
proportions (x:: AbstractArray{<:Integer} , y:: AbstractArray{<:Integer} , levels:: NTuple{2,UnitRange{<:Integer}} , wv:: AbstractWeights ) =
209
- counts (x, y, levels, wv) .* inv ( sum (wv) )
209
+ counts (x, y, levels, wv) / sum (wv)
210
210
211
211
proportions (x:: AbstractArray{<:Integer} , y:: AbstractArray{<:Integer} , ks:: NTuple{2,Integer} ) =
212
212
proportions (x, y, (1 : ks[1 ], 1 : ks[2 ]))
0 commit comments