Skip to content

Commit

Permalink
Merge pull request #349 from mixOmicsTeam/303-perf-multiple-solutions
Browse files Browse the repository at this point in the history
update perf to deal with multiple replacement plus prints warning
  • Loading branch information
evaham1 authored Nov 28, 2024
2 parents ea9bc05 + b0c9521 commit a747793
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/perf.R
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,13 @@ perf.mixo_plsda <- function(object,
}
else
{
ncomp_opt[measure, ijk] = which(t(rowMeans(mat.error.rate[[measure_i]][[ijk]])) == min(t(rowMeans(mat.error.rate[[measure_i]][[ijk]]))))
if(length(min(t(rowMeans(mat.error.rate[[measure_i]][[ijk]])))) > 1){
# avoid multiple replacements - fix for issue #303
print("More than one component found with same minimum error rate, selecting smaller component...")
ncomp_opt[measure, ijk] = which(t(rowMeans(mat.error.rate[[measure_i]][[ijk]])) == min(t(rowMeans(mat.error.rate[[measure_i]][[ijk]]))))[1]
} else{
ncomp_opt[measure, ijk] = which(t(rowMeans(mat.error.rate[[measure_i]][[ijk]])) == min(t(rowMeans(mat.error.rate[[measure_i]][[ijk]]))))
}
}
}
}
Expand Down

0 comments on commit a747793

Please sign in to comment.