[Phylobase-commits] r525 - in pkg: R tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 20 05:07:38 CEST 2009
Author: bbolker
Date: 2009-08-20 05:07:38 +0200 (Thu, 20 Aug 2009)
New Revision: 525
Modified:
pkg/R/class-phylomats.R
pkg/R/setAs-Methods.R
pkg/tests/roundtrip.R
Log:
make phylo4vcov -> phylo4 order correctly
comment tweaks
test tweaking
Modified: pkg/R/class-phylomats.R
===================================================================
--- pkg/R/class-phylomats.R 2009-08-19 23:23:46 UTC (rev 524)
+++ pkg/R/class-phylomats.R 2009-08-20 03:07:38 UTC (rev 525)
@@ -79,9 +79,10 @@
## add root node to edge matrix and branch lengths
temptree$edgemat <- rbind(temptree$edgemat,c(NA,rootnode))
temptree$edgelens <- c(temptree$edgelens,NA)
- phylo4(temptree$edgemat,edge.length=temptree$edgelens,
+ reorder(phylo4(temptree$edgemat,edge.length=temptree$edgelens,
tip.label=rownames(from),
- edge.label=from at edge.label,order=from at order)
+ edge.label=from at edge.label,order="unknown"),
+ "preorder")
})
Modified: pkg/R/setAs-Methods.R
===================================================================
--- pkg/R/setAs-Methods.R 2009-08-19 23:23:46 UTC (rev 524)
+++ pkg/R/setAs-Methods.R 2009-08-20 03:07:38 UTC (rev 525)
@@ -69,7 +69,7 @@
## BMB: adding an explicit as method, and the warning,
## here is a very bad idea, because
## even implicit conversions from phylo4d to phylo4 (e.g.
-## to use inhertied methods) will produce the warning
+## to use inherited methods) will produce the warning
## setAs("phylo4d", "phylo4",function(from,to) {
## warning("losing data while coercing phylo4d to phylo")
@@ -116,6 +116,7 @@
y$edge.length <- NULL
if (length(y$node.label) == 0)
y$node.label <- NULL
+ ## how do we tell if there is an explicit root edge?
if (isRooted(from)) {
root.edge <- brlen0[rootNode(from)]
if (!is.na(root.edge)) y$root.edge <- root.edge
Modified: pkg/tests/roundtrip.R
===================================================================
--- pkg/tests/roundtrip.R 2009-08-19 23:23:46 UTC (rev 524)
+++ pkg/tests/roundtrip.R 2009-08-20 03:07:38 UTC (rev 525)
@@ -10,8 +10,8 @@
t5 <- as(t1,"phylo")
stopifnot(identical(t0,t5))
-## t2<-as(t1,"phylo4vcov")
-## t3<-as(t2,"phylo4")
-## t4<-as(t3,"phylo")
+t2<-as(t1,"phylo4vcov")
+t3<-as(t2,"phylo4")
+t4<-as(t3,"phylo")
+## stopifnot(identical(t0,t4))
-## plot(test.tree) #CRASHES R!
More information about the Phylobase-commits
mailing list