]> git.donarmstrong.com Git - ape.git/blobdiff - R/bind.tree.R
new operators for "multiPhylo" + fixed small bug in bind.tree()
[ape.git] / R / bind.tree.R
index 4202e2ea2b591a1af29a3a5dcc47f0ace1854cee..b862b37db3d32a7f8848d07d54dbb48097042951 100644 (file)
@@ -1,4 +1,4 @@
-## bind.tree.R (2010-03-15)
+## bind.tree.R (2010-05-25)
 
 ##    Bind Trees
 
@@ -46,7 +46,7 @@ bind.tree <- function(x, y, where = "root", position = 0, interactive = FALSE)
            wbl <- TRUE, {
                x$edge.length <- y$edge.length <- NULL
                wbl <- FALSE
-               warning("one tree has no branch lengths, they will be ignored")
+               warning("one tree has no branch lengths, they have been ignored")
            },
            wbl <- FALSE)
 
@@ -77,6 +77,14 @@ bind.tree <- function(x, y, where = "root", position = 0, interactive = FALSE)
         }
     }
 
+    ## the special of substituting two tips:
+    if (case == 2 && ny == 1 && !position) {
+        x$tip.label[x$edge[i, 2]] <- y$tip.label
+        if (wbl)
+            x$edge.length[i] <- x$edge.length[i] + y$edge.length
+        return(x)
+    }
+
     x <- reorder(x)
     y <- reorder(y)