]> git.donarmstrong.com Git - ape.git/blobdiff - R/summary.phylo.R
fix a few bugs + correct some the man page of sh.test()
[ape.git] / R / summary.phylo.R
index cffe0d1da6769e22059ba94c1f32d273a5a47cb9..54c2eaa51e3f30f317adadc7a135c4f8fd9b1f34 100644 (file)
@@ -1,8 +1,8 @@
-## summary.phylo.R (2007-12-29)
+## summary.phylo.R (2008-04-22)
 
 ##   Print Summary of a Phylogeny
 
-## Copyright 2003-2007 Emmanuel Paradis, and 2006 Ben Bolker
+## Copyright 2003-2008 Emmanuel Paradis, and 2006 Ben Bolker
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -121,8 +121,27 @@ print.multiPhylo <- function(x, details = FALSE, ...)
     cat("\n")
 }
 
+"[[.multiPhylo" <- function(x, i)
+{
+    class(x) <- NULL
+    phy <- x[[i]]
+    if (!is.null(attr(x, "TipLabel")))
+        phy$tip.label <- attr(x, "TipLabel")
+    phy
+}
+
+`$.multiPhylo` <- function(x, name) x[[name]]
+
 "[.multiPhylo" <- function(x, i)
 {
     class(x) <- NULL
-    structure(x[i], class = "multiPhylo")
+    structure(x[i], TipLabel = attr(x, "TipLabel"),
+              class = "multiPhylo")
+}
+
+str.multiPhylo <- function(object, ...)
+{
+    class(object) <- NULL
+    cat('Class "multiPhylo"\n')
+    str(object, ...)
 }