]> git.donarmstrong.com Git - ape.git/blobdiff - R/nj.R
small changed in add.scale.bar
[ape.git] / R / nj.R
diff --git a/R/nj.R b/R/nj.R
index 2155f6b1f77d02a997558dc8adb44b2777b53e76..dada70e52a2a63b20777f98a6bee4ecfab65320e 100644 (file)
--- 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)