Skip to content

Commit 59448dc

Browse files
committed
move statistics from Base to StatsBase
this commit removes cor, cov, median, median!, middle, quantile, quantile!, std, stdm, var, varm and linreg and moves them to StatsBase fix #25571 (comment) (included in StatsBase.jl/#379) fix #23769 (included in StatsBase.jl/#379) fix #27140
1 parent b5c0cb0 commit 59448dc

20 files changed

+30
-1422
lines changed

base/deprecated.jl

+14-14
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,6 @@ deprecate(Base, :DSP, 2)
296296
using .DSP
297297
export conv, conv2, deconv, filt, filt!, xcorr
298298

299-
# PR #21709
300-
@deprecate cov(x::AbstractVector, corrected::Bool) cov(x, corrected=corrected)
301-
@deprecate cov(x::AbstractMatrix, vardim::Int, corrected::Bool) cov(x, dims=vardim, corrected=corrected)
302-
@deprecate cov(X::AbstractVector, Y::AbstractVector, corrected::Bool) cov(X, Y, corrected=corrected)
303-
@deprecate cov(X::AbstractVecOrMat, Y::AbstractVecOrMat, vardim::Int, corrected::Bool) cov(X, Y, dims=vardim, corrected=corrected)
304-
305299
# PR #22325
306300
# TODO: when this replace is removed from deprecated.jl:
307301
# 1) rename the function replace_new from strings/util.jl to replace
@@ -1347,14 +1341,6 @@ export readandwrite
13471341
@deprecate findmin(A::AbstractArray, dims) findmin(A, dims=dims)
13481342

13491343
@deprecate mean(A::AbstractArray, dims) mean(A, dims=dims)
1350-
@deprecate varm(A::AbstractArray, m::AbstractArray, dims; kwargs...) varm(A, m; kwargs..., dims=dims)
1351-
@deprecate var(A::AbstractArray, dims; kwargs...) var(A; kwargs..., dims=dims)
1352-
@deprecate std(A::AbstractArray, dims; kwargs...) std(A; kwargs..., dims=dims)
1353-
@deprecate cov(X::AbstractMatrix, dim::Int; kwargs...) cov(X; kwargs..., dims=dim)
1354-
@deprecate cov(x::AbstractVecOrMat, y::AbstractVecOrMat, dim::Int; kwargs...) cov(x, y; kwargs..., dims=dim)
1355-
@deprecate cor(X::AbstractMatrix, dim::Int) cor(X, dims=dim)
1356-
@deprecate cor(x::AbstractVecOrMat, y::AbstractVecOrMat, dim::Int) cor(x, y, dims=dim)
1357-
@deprecate median(A::AbstractArray, dims; kwargs...) median(A; kwargs..., dims=dims)
13581344

13591345
@deprecate mapreducedim(f, op, A::AbstractArray, dims) mapreduce(f, op, A, dims=dims)
13601346
@deprecate mapreducedim(f, op, A::AbstractArray, dims, v0) mapreduce(f, op, v0, A, dims=dims)
@@ -1664,6 +1650,20 @@ end
16641650
# when this is removed, `isbitstype(typeof(x))` can be replaced with `isbits(x)`
16651651
@deprecate isbits(@nospecialize(t::Type)) isbitstype(t)
16661652

1653+
# statistics to StatsBase (#27152)
1654+
@deprecate_moved cor "StatsBase"
1655+
@deprecate_moved cov "StatsBase"
1656+
@deprecate_moved median "StatsBase"
1657+
@deprecate_moved median! "StatsBase"
1658+
@deprecate_moved middle "StatsBase"
1659+
@deprecate_moved quantile "StatsBase"
1660+
@deprecate_moved quantile! "StatsBase"
1661+
@deprecate_moved std "StatsBase"
1662+
@deprecate_moved stdm "StatsBase"
1663+
@deprecate_moved var "StatsBase"
1664+
@deprecate_moved varm "StatsBase"
1665+
@deprecate_moved linreg "StatsBase"
1666+
16671667
# Special string deprecation
16681668
@deprecate start(s::AbstractString) firstindex(s)
16691669
@deprecate next(s::AbstractString, i::Integer) iterate(s, i)

base/exports.jl

-11
Original file line numberDiff line numberDiff line change
@@ -633,19 +633,8 @@ export
633633
set_zero_subnormals,
634634

635635
# statistics
636-
cor,
637-
cov,
638636
mean!,
639637
mean,
640-
median!,
641-
median,
642-
middle,
643-
quantile!,
644-
quantile,
645-
std,
646-
stdm,
647-
var,
648-
varm,
649638

650639
# iteration
651640
done,

base/range.jl

-2
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,6 @@ function mean(r::AbstractRange{<:Real})
854854
(first(r) + last(r)) / 2
855855
end
856856

857-
median(r::AbstractRange{<:Real}) = mean(r)
858-
859857
function _in_range(x, r::AbstractRange)
860858
if step(r) == 0
861859
return !isempty(r) && first(r) == x

0 commit comments

Comments
 (0)