X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Fnj.R;h=dada70e52a2a63b20777f98a6bee4ecfab65320e;hb=fab4946bb5d41cd408dffd4b66aae8a697690cfa;hp=2155f6b1f77d02a997558dc8adb44b2777b53e76;hpb=01fef1c23b7a8c96d003f14d82ba8a3d61d2a079;p=ape.git diff --git a/R/nj.R b/R/nj.R index 2155f6b..dada70e 100644 --- a/R/nj.R +++ b/R/nj.R @@ -1,4 +1,4 @@ -## nj.R (2009-07-10) +## nj.R (2009-11-23) ## Neighbor-Joining Tree Estimation @@ -10,6 +10,8 @@ nj <- function(X) { if (is.matrix(X)) X <- as.dist(X) + if (any(is.na(X))) + stop("missing values are not allowed in the distance matrix") N <- attr(X, "Size") labels <- attr(X, "Labels") if (is.null(labels)) labels <- as.character(1:N)