Skip to content

Commit

Permalink
Fix error message
Browse files Browse the repository at this point in the history
Number of groups was sometimes incorrect.
  • Loading branch information
nalimilan committed Dec 30, 2024
1 parent cc547a3 commit 397c227
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/extras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,8 @@ function cut(x::AbstractArray, ngroups::Integer;
breaks = quantile(xnm, (1:ngroups-1)/ngroups)
breaks = [min_x; breaks; max_x]
if !allowempty && !allunique(@view breaks[1:end-1])
n = length(unique(breaks)) - 1
throw(ArgumentError("cannot compute $ngroups quantiles: `quantile` " *
"returned only $n group(s) due to duplicated values in `x`. " *
throw(ArgumentError("cannot compute $ngroups quantiles due to " *
"too many duplicated values in `x`. " *
"Pass `allowempty=true` to allow empty quantiles or " *
"choose a lower value for `ngroups`."))
end
Expand Down

0 comments on commit 397c227

Please sign in to comment.