Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/scalarstats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ median, 75th percentile, and maxmimum.
function summarystats(a::AbstractArray{T}) where T<:Union{Real,Missing}
# `mean` doesn't fail on empty input but rather returns `NaN`, so we can use the
# return type to populate the `SummaryStats` structure.
a = length(size(a)) != 1 ? a[:] : a
s = T >: Missing ? collect(skipmissing(a)) : a
m = mean(s)
R = typeof(m)
Expand Down
13 changes: 13 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,16 @@ describe(io, fill("s", 3))
Type: String
Number Unique: 1
"""
describe(io, reshape(collect(1:100), (10, 10)))
@test String(take!(io)) == """
Summary Stats:
Length: 100
Missing Count: 0
Mean: 50.500000
Minimum: 1.000000
1st Quartile: 25.750000
Median: 50.500000
3rd Quartile: 75.250000
Maximum: 100.000000
Type: $Int
"""