]> git.donarmstrong.com Git - ape.git/blob - R/treePop.R
some changes for ape 3.0-6
[ape.git] / R / treePop.R
1 ## treePop.R (2011-10-11)
2
3 ##   Tree Popping
4
5 ## Copyright 2011 Andrei-Alin Popescu
6
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
9
10 treePop <- function(obj)
11 {
12     mf <- obj$matsplit
13     labels <- obj$labels
14     n <- length(labels)
15     imf <- as.integer(mf)
16     freq <- obj$freq
17     mimf <- matrix(imf, nrow(mf), ncol(mf))
18     ans <- .C("treePop", mimf, as.double(freq), as.integer(ncol(mf)),
19               as.integer(n), integer(2*n - 3), integer(2*n - 3),
20               double(2*n - 3), DUP = FALSE, NAOK = TRUE, PACKAGE = "ape")
21     obj <- list(edge = cbind(ans[[5]], ans[[6]]), edge.length = ans[[7]],
22                 tip.label = labels, Nnode = n - 2L)
23     class(obj) <- "phylo"
24     reorder(obj)
25 }