]> git.donarmstrong.com Git - ape.git/blob - R/ewLasso.R
bd8f7fe0ad59255417ceef129015d3d8f321bef3
[ape.git] / R / ewLasso.R
1 ## ewLasso.R (2013-03-30)
2
3 ##   Lasso Tree
4
5 ## Copyright 2013 Andrei-Alin Popescu
6
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
9
10 ewLasso <- function(X, phy)
11 {
12     if (is.matrix(X)) X <- as.dist(X)
13     X[is.na(X)] <- -1
14     X[X < 0] <- -1
15     X[is.nan(X)] <- -1
16
17     N <- attr(X, "Size")
18     labels <- attr(X, "Labels")
19     if (is.null(labels)) labels <- as.character(1:N)
20     ans <- .C("ewLasso", as.double(X), as.integer(N),
21               phy$edge[, 1], phy$edge[, 2],
22               DUP = FALSE, NAOK = TRUE, PACKAGE = "ape")
23 }