[Phylobase-commits] r584 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 25 02:58:59 CEST 2009
Author: bbolker
Date: 2009-08-25 02:58:59 +0200 (Tue, 25 Aug 2009)
New Revision: 584
Modified:
pkg/R/setAs-Methods.R
Log:
added error if unknown ordering imported from ape
added warning if unknown ordering exported to ape
Modified: pkg/R/setAs-Methods.R
===================================================================
--- pkg/R/setAs-Methods.R 2009-08-25 00:51:06 UTC (rev 583)
+++ pkg/R/setAs-Methods.R 2009-08-25 00:58:59 UTC (rev 584)
@@ -26,11 +26,11 @@
}
}
oldorder <- attr(from,"order")
- neworder <- if (is.null(oldorder)) { "unknown" } else {
- switch(oldorder,
- pruningwise="pruningwise",
- cladewise="preorder")
- }
+ neworder <- if (is.null(oldorder)) { "unknown" } else
+ if (!oldorder %in% phylo4_orderings) {
+ stop("unknown ordering '",oldorder,"' in ape object")
+ } else if (oldorder=="cladewise") "preorder"
+ else oldorder
attr(from,"order") <- NULL
newobj <- phylo4(from$edge, from$edge.length, from$tip.label,
node.label = from$node.label,
@@ -113,9 +113,10 @@
preorder = 'cladewise',
unknown = 'unknown',
pruningwise = 'pruningwise')
- } else {
- ## warning ??
- }
+ } else {
+ ## warning ??
+ warning("trees with unknown order may be unsafe in ape")
+ }
if (length(y$edge.length) == 0)
y$edge.length <- NULL
if (length(y$node.label) == 0)
More information about the Phylobase-commits
mailing list