Skip to content

Commit

Permalink
fix bug in computeCrowdingDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbossek committed Aug 25, 2015
1 parent 2b53dad commit 1f89448
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/computeCrowdingDistance.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ computeCrowdingDistance = function(x) {
cds[ord[1]] = Inf
cds[ord[n]] = Inf
# update the remaining crowding numbers
for (j in 2:(n - 1L)) {
cds[ord[j]] = cds[ord[j]] + (x[i, ord[j + 1L]] - x[i, ord[j - 1L]])
if (n > 2L) {
for (j in 2:(n - 1L)) {
cds[ord[j]] = cds[ord[j]] + (x[i, ord[j + 1L]] - x[i, ord[j - 1L]])
}
}
}
return(cds)
Expand Down

0 comments on commit 1f89448

Please sign in to comment.