[Phylobase-commits] r530 - in pkg: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 20 17:57:03 CEST 2009
Author: bbolker
Date: 2009-08-20 17:57:02 +0200 (Thu, 20 Aug 2009)
New Revision: 530
Modified:
pkg/NAMESPACE
pkg/R/methods-phylo4.R
Log:
added match.arg(), renamed back to orderIndex (not exported)
Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE 2009-08-20 15:37:05 UTC (rev 529)
+++ pkg/NAMESPACE 2009-08-20 15:57:02 UTC (rev 530)
@@ -83,7 +83,7 @@
#export(internEdges, terminEdges, isPoly)
## presumably these should remain hidden
-#export(.createLabels, .createEdge, .phylo4Data, .orderIndex, .genlab,
+#export(.createLabels, .createEdge, .phylo4Data, orderIndex, .genlab,
# .chnumsort, .phylo4ToDataFrame, .bubLegendGrob)
## recently removed:
Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R 2009-08-20 15:37:05 UTC (rev 529)
+++ pkg/R/methods-phylo4.R 2009-08-20 15:57:02 UTC (rev 530)
@@ -44,7 +44,7 @@
### 6.7. summary()
### 7. Ordering
-### 7.1. .orderIndex()
+### 7.1. orderIndex()
### 7.2. reorder()
@@ -470,10 +470,11 @@
### Ordering
#########################################################
-.orderIndex <- function(phy, order = c('preorder', 'postorder')) {
+orderIndex <- function(phy, order = c('preorder', 'postorder')) {
## get an root node free edge matrix
## R scoping allows us to call this variable in
## the postOrder() func defined above
+ order <- match.arg(order)
edge <- phy at edge[!is.na(phy at edge[, 1]), ]
## Sort edges -- ensures that starting order of edge matrix doesn't
## affect the order of reordered trees
@@ -516,7 +517,7 @@
function(x, order = c('preorder', 'postorder')) {
## call orderIndex and use that index to order edges, labels and lengths
order <- match.arg(order)
- index <- .orderIndex(x, order)
+ index <- orderIndex(x, order)
x at order <- order
x at edge <- x at edge[index, ]
if(hasEdgeLabels(x)) { x at edge.label <- x at edge.label[index] }
More information about the Phylobase-commits
mailing list