[Phylobase-commits] r410 - branches/newlabels/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 28 16:39:20 CET 2008


Author: bbolker
Date: 2008-12-28 16:39:20 +0100 (Sun, 28 Dec 2008)
New Revision: 410

Modified:
   branches/newlabels/R/class-phylo4.R
Log:
  label node and tip label vectors with node numbers



Modified: branches/newlabels/R/class-phylo4.R
===================================================================
--- branches/newlabels/R/class-phylo4.R	2008-12-27 20:44:41 UTC (rev 409)
+++ branches/newlabels/R/class-phylo4.R	2008-12-28 15:39:20 UTC (rev 410)
@@ -49,7 +49,7 @@
         if(length(tip.label) != ntips) stop("the tip labels are not consistent with the number of tips")
         tip.label <- as.character(tip.label)
     }
-
+    names(tip.label) <- seq(along=tip.label)
     ## node.label for internal nodes
     nnodes <- length(unique(na.omit(c(edge)))) - ntips
     ##    if(is.null(node.label)) {
@@ -61,6 +61,7 @@
       ## is.na(node.label) <- TRUE ## ???
     } else if (length(node.label)>0 && length(node.label) != nnodes)
       stop("number of node labels is not consistent with the number of nodes")
+    names(node.label) <- seq(along=node.label)
     ## edge.label
     ## an edge is named by the descendant
     if(is.null(edge.label)) {



More information about the Phylobase-commits mailing list