Skip to content

Commit

Permalink
move statistics from Base to StatsBase
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fredrikekre committed May 20, 2018
1 parent b5c0cb0 commit 59448dc
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 1,422 deletions.
28 changes: 14 additions & 14 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,6 @@ deprecate(Base, :DSP, 2)
using .DSP
export conv, conv2, deconv, filt, filt!, xcorr

# PR #21709
@deprecate cov(x::AbstractVector, corrected::Bool) cov(x, corrected=corrected)
@deprecate cov(x::AbstractMatrix, vardim::Int, corrected::Bool) cov(x, dims=vardim, corrected=corrected)
@deprecate cov(X::AbstractVector, Y::AbstractVector, corrected::Bool) cov(X, Y, corrected=corrected)
@deprecate cov(X::AbstractVecOrMat, Y::AbstractVecOrMat, vardim::Int, corrected::Bool) cov(X, Y, dims=vardim, corrected=corrected)

# PR #22325
# TODO: when this replace is removed from deprecated.jl:
# 1) rename the function replace_new from strings/util.jl to replace
Expand Down Expand Up @@ -1347,14 +1341,6 @@ export readandwrite
@deprecate findmin(A::AbstractArray, dims) findmin(A, dims=dims)

@deprecate mean(A::AbstractArray, dims) mean(A, dims=dims)
@deprecate varm(A::AbstractArray, m::AbstractArray, dims; kwargs...) varm(A, m; kwargs..., dims=dims)
@deprecate var(A::AbstractArray, dims; kwargs...) var(A; kwargs..., dims=dims)
@deprecate std(A::AbstractArray, dims; kwargs...) std(A; kwargs..., dims=dims)
@deprecate cov(X::AbstractMatrix, dim::Int; kwargs...) cov(X; kwargs..., dims=dim)
@deprecate cov(x::AbstractVecOrMat, y::AbstractVecOrMat, dim::Int; kwargs...) cov(x, y; kwargs..., dims=dim)
@deprecate cor(X::AbstractMatrix, dim::Int) cor(X, dims=dim)
@deprecate cor(x::AbstractVecOrMat, y::AbstractVecOrMat, dim::Int) cor(x, y, dims=dim)
@deprecate median(A::AbstractArray, dims; kwargs...) median(A; kwargs..., dims=dims)

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

# statistics to StatsBase (#27152)
@deprecate_moved cor "StatsBase"
@deprecate_moved cov "StatsBase"
@deprecate_moved median "StatsBase"
@deprecate_moved median! "StatsBase"
@deprecate_moved middle "StatsBase"
@deprecate_moved quantile "StatsBase"
@deprecate_moved quantile! "StatsBase"
@deprecate_moved std "StatsBase"
@deprecate_moved stdm "StatsBase"
@deprecate_moved var "StatsBase"
@deprecate_moved varm "StatsBase"
@deprecate_moved linreg "StatsBase"

# Special string deprecation
@deprecate start(s::AbstractString) firstindex(s)
@deprecate next(s::AbstractString, i::Integer) iterate(s, i)
Expand Down
11 changes: 0 additions & 11 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -633,19 +633,8 @@ export
set_zero_subnormals,

# statistics
cor,
cov,
mean!,
mean,
median!,
median,
middle,
quantile!,
quantile,
std,
stdm,
var,
varm,

# iteration
done,
Expand Down
2 changes: 0 additions & 2 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,6 @@ function mean(r::AbstractRange{<:Real})
(first(r) + last(r)) / 2
end

median(r::AbstractRange{<:Real}) = mean(r)

function _in_range(x, r::AbstractRange)
if step(r) == 0
return !isempty(r) && first(r) == x
Expand Down
Loading

0 comments on commit 59448dc

Please sign in to comment.