Skip to content

Commit 201b0da

Browse files
committed
fix(ClonalDiversityPlot): fix calculating Gini coefficient
1 parent 4c756d4 commit 201b0da

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

R/clonaldivplot.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ClonalDiversity <- function(
1010
method <- match.arg(method)
1111
if (method == "gini.coeff") {
1212
div_fn <- function(dat) {
13+
dat <- sort(dat)
1314
n <- length(dat)
1415
1 / n * (n + 1 - 2 * sum((n + 1 - 1:n) * dat) / sum(dat))
1516
}

0 commit comments

Comments
 (0)