]> git.donarmstrong.com Git - ape.git/blobdiff - R/ewLasso.R
final commit for ape 3.0-8
[ape.git] / R / ewLasso.R
index bd8f7fe0ad59255417ceef129015d3d8f321bef3..ad57eb13ceadccd1aa111238246e5303366cf678 100644 (file)
@@ -1,4 +1,4 @@
-## ewLasso.R (2013-03-30)
+## ewLasso.R (2013-04-02)
 
 ##   Lasso Tree
 
@@ -14,10 +14,15 @@ ewLasso <- function(X, phy)
     X[X < 0] <- -1
     X[is.nan(X)] <- -1
 
+    if (is.rooted(phy)) {
+        phy <- unroot(phy)
+        warning("'phy' is rooted: it was unrooted for this operation")
+    }
+
     N <- attr(X, "Size")
     labels <- attr(X, "Labels")
     if (is.null(labels)) labels <- as.character(1:N)
     ans <- .C("ewLasso", as.double(X), as.integer(N),
-              phy$edge[, 1], phy$edge[, 2],
+              as.integer(phy$edge[, 1]), as.integer(phy$edge[, 2]),
               DUP = FALSE, NAOK = TRUE, PACKAGE = "ape")
 }