X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2FewLasso.R;fp=R%2FewLasso.R;h=bd8f7fe0ad59255417ceef129015d3d8f321bef3;hb=c488b74490ee3d9d200de0e471881f002a18fe4f;hp=0000000000000000000000000000000000000000;hpb=646d8be3497d656d95331e2c7f6bef5d2ff86b2c;p=ape.git diff --git a/R/ewLasso.R b/R/ewLasso.R new file mode 100644 index 0000000..bd8f7fe --- /dev/null +++ b/R/ewLasso.R @@ -0,0 +1,23 @@ +## ewLasso.R (2013-03-30) + +## Lasso Tree + +## Copyright 2013 Andrei-Alin Popescu + +## This file is part of the R-package `ape'. +## See the file ../COPYING for licensing issues. + +ewLasso <- function(X, phy) +{ + if (is.matrix(X)) X <- as.dist(X) + X[is.na(X)] <- -1 + X[X < 0] <- -1 + X[is.nan(X)] <- -1 + + 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], + DUP = FALSE, NAOK = TRUE, PACKAGE = "ape") +}