diff --git a/R/IWScore.R b/R/IWScore.R index 602a81192..99c2fe1e6 100644 --- a/R/IWScore.R +++ b/R/IWScore.R @@ -39,9 +39,9 @@ IWScore <- function (tree, dataset, concavity=4) { homoplasies <- steps - minSteps # TODO remove this paranoid check once 100% happy with minSteps calculation. - if (homoplasies < 0) stop("Minimum steps have been miscalculated. - Please report this bug at - https://github.com/ms609/TreeSearch/issues/new") + if (any(homoplasies < 0)) stop("Minimum steps have been miscalculated.\n", + " Please report this bug at:\n", + " https://github.com/ms609/TreeSearch/issues/new") fit <- homoplasies / (homoplasies + concavity) # Return: sum(fit * weight)